packer/rpc: if stream ID 0 is used, paic

This commit is contained in:
Mitchell Hashimoto 2013-12-21 08:07:34 -08:00
parent 901929356f
commit 3e08ccba00
1 changed files with 5 additions and 3 deletions

View File

@ -117,7 +117,8 @@ func (m *MuxConn) Accept(id uint32) (io.ReadWriteCloser, error) {
// If the stream isn't closed, then it is already open somehow
if stream.state != streamStateSynRecv && stream.state != streamStateClosed {
return nil, fmt.Errorf("Stream %d already open in bad state: %d", id, stream.state)
panic(fmt.Sprintf(
"Stream %d already open in bad state: %d", id, stream.state))
}
if stream.state == streamStateClosed {
@ -151,8 +152,9 @@ func (m *MuxConn) Dial(id uint32) (io.ReadWriteCloser, error) {
// reaper should clear out old streams once in awhile.
if stream, ok := m.streamsDial[id]; ok {
m.muDial.Unlock()
return nil, fmt.Errorf(
"Stream %d already open for dial. State: %d", id, stream.state)
panic(fmt.Sprintf(
"Stream %d already open for dial. State: %d",
id, stream.state))
}
// Create the new stream and put it in our list. We can then