make noise work again

This commit is contained in:
Dmitriy Ryajov 2020-05-13 21:21:22 -06:00
parent 87e1cf924f
commit cf76edb0dd
1 changed files with 2 additions and 2 deletions

View File

@ -267,12 +267,12 @@ template read_s: untyped =
proc receiveHSMessage(sconn: Connection): Future[seq[byte]] {.async.} = proc receiveHSMessage(sconn: Connection): Future[seq[byte]] {.async.} =
var besize: array[2, byte] var besize: array[2, byte]
await sconn.stream.readExactly(addr besize[0], besize.len) await sconn.readExactly(addr besize[0], besize.len)
let size = uint16.fromBytesBE(besize).int let size = uint16.fromBytesBE(besize).int
trace "receiveHSMessage", size trace "receiveHSMessage", size
var buffer = newSeq[byte](size) var buffer = newSeq[byte](size)
if buffer.len > 0: if buffer.len > 0:
await sconn.stream.readExactly(addr buffer[0], buffer.len) await sconn.readExactly(addr buffer[0], buffer.len)
return buffer return buffer
proc sendHSMessage(sconn: Connection; buf: seq[byte]) {.async.} = proc sendHSMessage(sconn: Connection; buf: seq[byte]) {.async.} =