Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-bitswap
Commits
3f773ebd
Commit
3f773ebd
authored
Jan 03, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitswap net: always close
parent
cdefdb39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
network/ipfs_impl.go
network/ipfs_impl.go
+10
-13
No files found.
network/ipfs_impl.go
View file @
3f773ebd
...
@@ -97,23 +97,20 @@ func (bsnet *impl) Provide(ctx context.Context, k util.Key) error {
...
@@ -97,23 +97,20 @@ func (bsnet *impl) Provide(ctx context.Context, k util.Key) error {
// handleNewStream receives a new stream from the network.
// handleNewStream receives a new stream from the network.
func
(
bsnet
*
impl
)
handleNewStream
(
s
inet
.
Stream
)
{
func
(
bsnet
*
impl
)
handleNewStream
(
s
inet
.
Stream
)
{
defer
s
.
Close
()
if
bsnet
.
receiver
==
nil
{
if
bsnet
.
receiver
==
nil
{
return
return
}
}
go
func
()
{
received
,
err
:=
bsmsg
.
FromNet
(
s
)
defer
s
.
Close
()
if
err
!=
nil
{
go
bsnet
.
receiver
.
ReceiveError
(
err
)
received
,
err
:=
bsmsg
.
FromNet
(
s
)
return
if
err
!=
nil
{
}
go
bsnet
.
receiver
.
ReceiveError
(
err
)
return
}
p
:=
s
.
Conn
()
.
RemotePeer
()
ctx
:=
context
.
Background
()
bsnet
.
receiver
.
ReceiveMessage
(
ctx
,
p
,
received
)
}()
p
:=
s
.
Conn
()
.
RemotePeer
()
ctx
:=
context
.
Background
()
log
.
Debugf
(
"bsnet handleNewStream from %s"
,
s
.
Conn
()
.
RemotePeer
())
bsnet
.
receiver
.
ReceiveMessage
(
ctx
,
p
,
received
)
}
}
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