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
c34211a7
Commit
c34211a7
authored
Sep 19, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(bitswap) check for nil in public interface
parent
791637a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
bitswap.go
bitswap.go
+11
-0
No files found.
bitswap.go
View file @
c34211a7
package
bitswap
import
(
"errors"
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
...
...
@@ -87,6 +89,9 @@ func (bs *bitswap) Block(parent context.Context, k u.Key) (*blocks.Block, error)
// get better guarantees. May need shared sequence numbers.
bs
.
strategy
.
MessageSent
(
p
,
message
)
if
response
==
nil
{
return
}
bs
.
ReceiveMessage
(
ctx
,
p
,
response
)
}(
i
)
}
...
...
@@ -112,6 +117,12 @@ func (bs *bitswap) HasBlock(ctx context.Context, blk blocks.Block) error {
func
(
bs
*
bitswap
)
ReceiveMessage
(
ctx
context
.
Context
,
p
*
peer
.
Peer
,
incoming
bsmsg
.
BitSwapMessage
)
(
*
peer
.
Peer
,
bsmsg
.
BitSwapMessage
,
error
)
{
if
p
==
nil
{
return
nil
,
nil
,
errors
.
New
(
"Received nil Peer"
)
}
if
incoming
==
nil
{
return
nil
,
nil
,
errors
.
New
(
"Received nil Message"
)
}
bs
.
strategy
.
MessageReceived
(
p
,
incoming
)
...
...
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