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
b6a8a73a
Commit
b6a8a73a
authored
Apr 13, 2020
by
Dirk McCormick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: only mark sent wants as sent
parent
6c412605
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
internal/messagequeue/messagequeue.go
internal/messagequeue/messagequeue.go
+6
-5
No files found.
internal/messagequeue/messagequeue.go
View file @
b6a8a73a
...
...
@@ -566,15 +566,16 @@ func (mq *MessageQueue) extractOutgoingMessage(supportsHave bool) (bsmsg.BitSwap
}
// Add each regular want-have / want-block to the message
peerSent
Count
:=
0
for
;
peerSentCount
<
len
(
peerEntries
)
&&
msgSize
<
mq
.
maxMessageSize
;
peerSentCount
++
{
e
:=
peerEntries
[
peerSentCount
]
peerSent
:=
make
([]
wantlist
.
Entry
,
0
,
len
(
peerEntries
))
for
i
:=
0
;
i
<
len
(
peerEntries
)
&&
msgSize
<
mq
.
maxMessageSize
;
i
++
{
e
:=
peerEntries
[
i
]
// If the remote peer doesn't support HAVE / DONT_HAVE messages,
// don't send want-haves (only send want-blocks)
if
!
supportsHave
&&
e
.
WantType
==
pb
.
Message_Wantlist_Have
{
mq
.
peerWants
.
RemoveType
(
e
.
Cid
,
pb
.
Message_Wantlist_Have
)
}
else
{
msgSize
+=
mq
.
msg
.
AddEntry
(
e
.
Cid
,
e
.
Priority
,
e
.
WantType
,
true
)
peerSent
=
append
(
peerSent
,
e
)
}
}
...
...
@@ -603,8 +604,8 @@ func (mq *MessageQueue) extractOutgoingMessage(supportsHave bool) (bsmsg.BitSwap
for
i
:=
0
;
i
<
bcstSentCount
;
i
++
{
mq
.
bcstWants
.
MarkSent
(
bcstEntries
[
i
])
}
for
i
:=
0
;
i
<
peerSentCount
;
i
++
{
mq
.
peerWants
.
MarkSent
(
peerEntries
[
i
]
)
for
_
,
e
:=
range
peerSent
{
mq
.
peerWants
.
MarkSent
(
e
)
}
}
...
...
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