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
f74c469c
Commit
f74c469c
authored
Mar 06, 2020
by
Dirk McCormick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: avoid unnecessary go-routine
parent
99fe214a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
internal/session/sessionwantsender.go
internal/session/sessionwantsender.go
+9
-9
No files found.
internal/session/sessionwantsender.go
View file @
f74c469c
...
...
@@ -368,17 +368,17 @@ func (sws *sessionWantSender) processUpdates(updates []update) []cid.Cid {
// If any peers have sent us too many consecutive DONT_HAVEs, remove them
// from the session
if
len
(
prunePeers
)
>
0
{
for
p
:=
range
prunePeers
{
// Before removing the peer from the session, check if the peer
// sent us a HAVE for a block that we want
for
c
:=
range
sws
.
wants
{
if
sws
.
bpm
.
PeerHasBlock
(
p
,
c
)
{
delete
(
prunePeers
,
p
)
break
}
for
p
:=
range
prunePeers
{
// Before removing the peer from the session, check if the peer
// sent us a HAVE for a block that we want
for
c
:=
range
sws
.
wants
{
if
sws
.
bpm
.
PeerHasBlock
(
p
,
c
)
{
delete
(
prunePeers
,
p
)
break
}
}
}
if
len
(
prunePeers
)
>
0
{
go
func
()
{
for
p
:=
range
prunePeers
{
// Peer doesn't have anything we want, so remove it
...
...
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