Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
23286417
Commit
23286417
authored
Nov 05, 2016
by
Jeromy
Browse files
make sure to always close streams when youre done with them
parent
adfb6b8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
p2p/host/basic/basic_host.go
View file @
23286417
...
...
@@ -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
))
...
...
p2p/protocol/identify/id.go
View file @
23286417
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment