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
f6230f4f
Commit
f6230f4f
authored
Jul 15, 2017
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only open a message sender when we have messages to send
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
bf2c4e4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
wantmanager.go
wantmanager.go
+10
-9
No files found.
wantmanager.go
View file @
f6230f4f
...
...
@@ -187,15 +187,6 @@ func (mq *msgQueue) runQueue(ctx context.Context) {
}
func
(
mq
*
msgQueue
)
doWork
(
ctx
context
.
Context
)
{
if
mq
.
sender
==
nil
{
err
:=
mq
.
openSender
(
ctx
)
if
err
!=
nil
{
log
.
Infof
(
"cant open message sender to peer %s: %s"
,
mq
.
p
,
err
)
// TODO: cant connect, what now?
return
}
}
// grab outgoing message
mq
.
outlk
.
Lock
()
wlm
:=
mq
.
out
...
...
@@ -206,6 +197,16 @@ func (mq *msgQueue) doWork(ctx context.Context) {
mq
.
out
=
nil
mq
.
outlk
.
Unlock
()
// NB: only open a stream if we actually have data to send
if
mq
.
sender
==
nil
{
err
:=
mq
.
openSender
(
ctx
)
if
err
!=
nil
{
log
.
Infof
(
"cant open message sender to peer %s: %s"
,
mq
.
p
,
err
)
// TODO: cant connect, what now?
return
}
}
// send wantlist updates
for
{
// try to send this message until we fail.
err
:=
mq
.
sender
.
SendMsg
(
ctx
,
wlm
)
...
...
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