From 4f18dd30e9b9aa9c043cf371765df6a37b8a9265 Mon Sep 17 00:00:00 2001 From: diegomrsantos Date: Thu, 29 Sep 2022 20:02:10 +0200 Subject: [PATCH] Handle trying to write empty byte seq (#780) --- libp2p/protocols/connectivity/relay/utils.nim | 14 ++++++++------ libp2p/stream/chronosstream.nim | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libp2p/protocols/connectivity/relay/utils.nim b/libp2p/protocols/connectivity/relay/utils.nim index c5449aaa3..275a26f09 100644 --- a/libp2p/protocols/connectivity/relay/utils.nim +++ b/libp2p/protocols/connectivity/relay/utils.nim @@ -64,15 +64,17 @@ proc bridge*(connSrc: Connection, connDst: Connection) {.async.} = await futSrc or futDst if futSrc.finished(): bufRead = await futSrc - bytesSendFromSrcToDst.inc(bufRead) - await connDst.write(@bufSrcToDst[0.. 0: + bytesSendFromSrcToDst.inc(bufRead) + await connDst.write(@bufSrcToDst[0.. 0: + bytesSendFromDstToSrc += bufRead + await connSrc.write(bufDstToSrc[0..