Commit 23286417 authored by Jeromy's avatar Jeromy
Browse files

make sure to always close streams when youre done with them

parent adfb6b8f
......@@ -117,6 +117,7 @@ func (h *BasicHost) newStreamHandler(s inet.Stream) {
} else {
log.Warning("protocol mux failed: %s (took %s)", err, took)
}
s.Close()
return
}
s.SetProtocol(protocol.ID(protoID))
......
......@@ -87,6 +87,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
c.Close()
return
}
defer s.Close()
s.SetProtocol(ID)
......@@ -97,7 +98,6 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
if err := msmux.SelectProtoOrFail(ID, s); err != nil {
log.Debugf("error writing stream header for %s", ID)
log.Event(context.TODO(), "IdentifyOpenFailed", c.RemotePeer())
s.Close()
return
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment