From 3e08ccba00966e46a9cefb48831c0489084b9eab Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 21 Dec 2013 08:07:34 -0800 Subject: [PATCH] packer/rpc: if stream ID 0 is used, paic --- packer/rpc/muxconn.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packer/rpc/muxconn.go b/packer/rpc/muxconn.go index d3200d843..206208033 100644 --- a/packer/rpc/muxconn.go +++ b/packer/rpc/muxconn.go @@ -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