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
3b80bf49
Commit
3b80bf49
authored
Dec 05, 2017
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitswap: better wantmanager allocation patterns
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
parent
bf9f36e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
wantmanager.go
wantmanager.go
+2
-2
No files found.
wantmanager.go
View file @
3b80bf49
...
@@ -94,7 +94,7 @@ type wantSet struct {
...
@@ -94,7 +94,7 @@ type wantSet struct {
}
}
func
(
pm
*
WantManager
)
addEntries
(
ctx
context
.
Context
,
ks
[]
*
cid
.
Cid
,
targets
[]
peer
.
ID
,
cancel
bool
,
ses
uint64
)
{
func
(
pm
*
WantManager
)
addEntries
(
ctx
context
.
Context
,
ks
[]
*
cid
.
Cid
,
targets
[]
peer
.
ID
,
cancel
bool
,
ses
uint64
)
{
var
entries
[]
*
bsmsg
.
Entry
entries
:=
make
(
[]
*
bsmsg
.
Entry
,
0
,
len
(
ks
))
for
i
,
k
:=
range
ks
{
for
i
,
k
:=
range
ks
{
entries
=
append
(
entries
,
&
bsmsg
.
Entry
{
entries
=
append
(
entries
,
&
bsmsg
.
Entry
{
Cancel
:
cancel
,
Cancel
:
cancel
,
...
@@ -340,7 +340,7 @@ func (pm *WantManager) Run() {
...
@@ -340,7 +340,7 @@ func (pm *WantManager) Run() {
pm
.
stopPeerHandler
(
p
.
peer
)
pm
.
stopPeerHandler
(
p
.
peer
)
}
}
case
req
:=
<-
pm
.
peerReqs
:
case
req
:=
<-
pm
.
peerReqs
:
var
peers
[]
peer
.
ID
peers
:=
make
(
[]
peer
.
ID
,
0
,
len
(
pm
.
peers
))
for
p
:=
range
pm
.
peers
{
for
p
:=
range
pm
.
peers
{
peers
=
append
(
peers
,
p
)
peers
=
append
(
peers
,
p
)
}
}
...
...
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