set activity flag on noise / secio (#330)
This commit is contained in:
parent
d1f1e1b31e
commit
9c7e055310
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue