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
844e5d0d
Commit
844e5d0d
authored
May 17, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix receive loop error handling
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
parent
17aaaa9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
message/message.go
message/message.go
+3
-0
network/ipfs_impl.go
network/ipfs_impl.go
+9
-3
No files found.
message/message.go
View file @
844e5d0d
...
...
@@ -135,7 +135,10 @@ func (m *impl) AddBlock(b blocks.Block) {
func
FromNet
(
r
io
.
Reader
)
(
BitSwapMessage
,
error
)
{
pbr
:=
ggio
.
NewDelimitedReader
(
r
,
inet
.
MessageSizeMax
)
return
FromPBReader
(
pbr
)
}
func
FromPBReader
(
pbr
ggio
.
Reader
)
(
BitSwapMessage
,
error
)
{
pb
:=
new
(
pb
.
Message
)
if
err
:=
pbr
.
ReadMsg
(
pb
);
err
!=
nil
{
return
nil
,
err
...
...
network/ipfs_impl.go
View file @
844e5d0d
package
network
import
(
"io"
key
"github.com/ipfs/go-ipfs/blocks/key"
bsmsg
"github.com/ipfs/go-ipfs/exchange/bitswap/message"
routing
"github.com/ipfs/go-ipfs/routing"
host
"gx/ipfs/QmVL44QeoQDTYK8RVdpkyja7uYcK3WDNoBNHVLonf9YDtm/go-libp2p/p2p/host"
inet
"gx/ipfs/QmVL44QeoQDTYK8RVdpkyja7uYcK3WDNoBNHVLonf9YDtm/go-libp2p/p2p/net"
ma
"gx/ipfs/QmYzDkkgAEmrcNzFCiYo6L1dTX4EAG1gZkbtdbd9trL4vd/go-multiaddr"
ggio
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/io"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
logging
"gx/ipfs/QmaDNZ4QMdBdku1YZWBysufYyoQt1negQGNav6PLYarbY8/go-log"
peer
"gx/ipfs/QmbyvM8zRFDkbFdYyt1MnevUMJ62SiSGbfDFZ3Z8nkrzr4/go-libp2p-peer"
...
...
@@ -150,11 +153,14 @@ func (bsnet *impl) handleNewStream(s inet.Stream) {
return
}
reader
:=
ggio
.
NewDelimitedReader
(
s
,
inet
.
MessageSizeMax
)
for
{
received
,
err
:=
bsmsg
.
From
Net
(
s
)
received
,
err
:=
bsmsg
.
From
PBReader
(
reader
)
if
err
!=
nil
{
go
bsnet
.
receiver
.
ReceiveError
(
err
)
log
.
Debugf
(
"bitswap net handleNewStream from %s error: %s"
,
s
.
Conn
()
.
RemotePeer
(),
err
)
if
err
!=
io
.
EOF
{
go
bsnet
.
receiver
.
ReceiveError
(
err
)
log
.
Debugf
(
"bitswap net handleNewStream from %s error: %s"
,
s
.
Conn
()
.
RemotePeer
(),
err
)
}
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