mirror of https://github.com/vacp2p/nim-libp2p.git
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 &= cipher
|
||||
await sconn.stream.write(outbuf)
|
||||
sconn.activity = true
|
||||
|
||||
method handshake*(p: Noise, conn: Connection, initiator: bool): Future[SecureConn] {.async.} =
|
||||
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
|
||||
await sconn.stream.write(msg)
|
||||
sconn.activity = true
|
||||
|
||||
proc newSecioConn(conn: Connection,
|
||||
hash: string,
|
||||
|
|
|
@ -103,6 +103,7 @@ method readOnce*(s: SecureConn,
|
|||
|
||||
if s.buf.data().len() == 0:
|
||||
let buf = await s.readMessage()
|
||||
s.activity = true
|
||||
if buf.len == 0:
|
||||
raise newLPStreamIncompleteError()
|
||||
s.buf.add(buf)
|
||||
|
|
Loading…
Reference in New Issue