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
128c4a40
Commit
128c4a40
authored
Oct 26, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
benchmark secure channel
parent
5597393d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
bitswap.go
bitswap.go
+7
-1
No files found.
bitswap.go
View file @
128c4a40
package
bitswap
import
(
"time"
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/go-datastore"
...
...
@@ -67,6 +69,10 @@ type bitswap struct {
// TODO ensure only one active request per key
func
(
bs
*
bitswap
)
Block
(
parent
context
.
Context
,
k
u
.
Key
)
(
*
blocks
.
Block
,
error
)
{
log
.
Debugf
(
"Get Block %v"
,
k
)
now
:=
time
.
Now
()
defer
func
()
{
log
.
Errorf
(
"GetBlock took %f secs"
,
time
.
Now
()
.
Sub
(
now
)
.
Seconds
())
}()
ctx
,
cancelFunc
:=
context
.
WithCancel
(
parent
)
bs
.
wantlist
.
Add
(
k
)
...
...
@@ -160,7 +166,7 @@ func (bs *bitswap) ReceiveMessage(ctx context.Context, p peer.Peer, incoming bsm
go
func
(
block
blocks
.
Block
)
{
err
:=
bs
.
HasBlock
(
ctx
,
block
)
// FIXME err ignored
if
err
!=
nil
{
log
.
Error
f
(
"HasBlock errored: %s"
,
err
)
log
.
Warning
f
(
"HasBlock errored: %s"
,
err
)
}
}(
block
)
}
...
...
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