diff --git a/libp2p/stream/chronosstream.nim b/libp2p/stream/chronosstream.nim index c1bca76..b3af6b6 100644 --- a/libp2p/stream/chronosstream.nim +++ b/libp2p/stream/chronosstream.nim @@ -60,9 +60,9 @@ method write*(s: ChronosStream, msg: seq[byte]) {.async.} = return withExceptions: - # Returns 0 sometimes when write fails - but there's not much we can do here? - if (await s.client.write(msg)) != msg.len: - raise (ref LPStreamError)(msg: "Write couldn't finish writing") + var writen = 0 + while (writen < msg.len): + writen += await s.client.write(msg[writen..