revert back allread

This commit is contained in:
Dmitriy Ryajov 2020-05-14 22:03:49 -06:00
parent f5c871518e
commit 6827cf9b61
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4

View File

@ -60,9 +60,9 @@ method write*(s: ChronosStream, msg: seq[byte]) {.async.} =
return
withExceptions:
var writen = 0
while (writen < msg.len):
writen += await s.client.write(msg[writen..<msg.len]) # TODO: does the slice create a copy here?
# 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")
method closed*(s: ChronosStream): bool {.inline.} =
result = s.client.closed