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
9cad93a8
Commit
9cad93a8
authored
Nov 18, 2014
by
Brian Tiger Chow
Committed by
Jeromy
Dec 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
naming
License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
a82ac0a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
bitswap.go
bitswap.go
+4
-4
No files found.
bitswap.go
View file @
9cad93a8
...
...
@@ -43,7 +43,7 @@ func New(ctx context.Context, p peer.Peer,
routing
:
routing
,
sender
:
network
,
wantlist
:
u
.
NewKeySet
(),
blockReq
:
make
(
chan
u
.
Key
,
32
),
blockReq
uests
:
make
(
chan
u
.
Key
,
32
),
}
network
.
SetDelegate
(
bs
)
go
bs
.
run
(
ctx
)
...
...
@@ -66,7 +66,7 @@ type bitswap struct {
notifications
notifications
.
PubSub
blockReq
chan
u
.
Key
blockReq
uests
chan
u
.
Key
// strategy listens to network traffic and makes decisions about how to
// interact with partners.
...
...
@@ -100,7 +100,7 @@ func (bs *bitswap) GetBlock(parent context.Context, k u.Key) (*blocks.Block, err
promise
:=
bs
.
notifications
.
Subscribe
(
ctx
,
k
)
select
{
case
bs
.
blockReq
<-
k
:
case
bs
.
blockReq
uests
<-
k
:
case
<-
parent
.
Done
()
:
return
nil
,
parent
.
Err
()
}
...
...
@@ -185,7 +185,7 @@ func (bs *bitswap) run(ctx context.Context) {
}
sendlist
=
nil
timeout
=
time
.
After
(
rebroadcastTime
)
case
k
:=
<-
bs
.
blockReq
:
case
k
:=
<-
bs
.
blockReq
uests
:
if
unsent
==
0
{
sendlist
=
bs
.
routing
.
FindProvidersAsync
(
ctx
,
k
,
peersPerSend
)
}
...
...
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