set activity flag on noise / secio (#330)

This commit is contained in:
Jacek Sieka 2020-08-15 07:36:15 +02:00 committed by GitHub
parent d1f1e1b31e
commit 9c7e055310
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 0 deletions

View File

@ -422,6 +422,7 @@ method write*(sconn: NoiseConnection, message: seq[byte]): Future[void] {.async.
outbuf &= besize outbuf &= besize
outbuf &= cipher outbuf &= cipher
await sconn.stream.write(outbuf) await sconn.stream.write(outbuf)
sconn.activity = true
method handshake*(p: Noise, conn: Connection, initiator: bool): Future[SecureConn] {.async.} = method handshake*(p: Noise, conn: Connection, initiator: bool): Future[SecureConn] {.async.} =
trace "Starting Noise handshake", initiator, peer = $conn trace "Starting Noise handshake", initiator, peer = $conn

View File

@ -236,6 +236,7 @@ method write*(sconn: SecioConn, message: seq[byte]) {.async.} =
trace "Writing message", message = msg.shortLog, left, offset trace "Writing message", message = msg.shortLog, left, offset
await sconn.stream.write(msg) await sconn.stream.write(msg)
sconn.activity = true
proc newSecioConn(conn: Connection, proc newSecioConn(conn: Connection,
hash: string, hash: string,

View File

@ -103,6 +103,7 @@ method readOnce*(s: SecureConn,
if s.buf.data().len() == 0: if s.buf.data().len() == 0:
let buf = await s.readMessage() let buf = await s.readMessage()
s.activity = true
if buf.len == 0: if buf.len == 0:
raise newLPStreamIncompleteError() raise newLPStreamIncompleteError()
s.buf.add(buf) s.buf.add(buf)