Merge pull request #137 from status-im/no-zero-send

Do not send empty messages packets at interval
This commit is contained in:
kdeme 2019-12-09 03:58:12 -08:00 committed by GitHub
commit 9165ff8549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -270,10 +270,11 @@ proc processQueue(peer: Peer) =
envelopes.add(message.env)
wakuPeer.received.incl(message)
trace "Sending envelopes", amount=envelopes.len
# Ignore failure of sending messages, this could occur when the connection
# gets dropped
traceAsyncErrors peer.messages(envelopes)
if envelopes.len() > 0:
trace "Sending envelopes", amount=envelopes.len
# Ignore failure of sending messages, this could occur when the connection
# gets dropped
traceAsyncErrors peer.messages(envelopes)
proc run(peer: Peer) {.async.} =
while peer.connectionState notin {Disconnecting, Disconnected}:

View File

@ -265,10 +265,11 @@ proc processQueue(peer: Peer) =
envelopes.add(message.env)
whisperPeer.received.incl(message)
trace "Sending envelopes", amount=envelopes.len
# Ignore failure of sending messages, this could occur when the connection
# gets dropped
traceAsyncErrors peer.messages(envelopes)
if envelopes.len() > 0:
trace "Sending envelopes", amount=envelopes.len
# Ignore failure of sending messages, this could occur when the connection
# gets dropped
traceAsyncErrors peer.messages(envelopes)
proc run(peer: Peer) {.async.} =
while peer.connectionState notin {Disconnecting, Disconnected}: