mirror of
https://github.com/codex-storage/nim-libp2p.git
synced 2025-02-02 22:23:50 +00:00
Properly use already specified MaxReadWriteTime as timeout
This commit is contained in:
parent
4034dfae19
commit
cf5dd27e57
@ -23,8 +23,6 @@ import ../muxer,
|
|||||||
logScope:
|
logScope:
|
||||||
topic = "Mplex"
|
topic = "Mplex"
|
||||||
|
|
||||||
const HandleTimeout = 30.seconds
|
|
||||||
|
|
||||||
type
|
type
|
||||||
Mplex* = ref object of Muxer
|
Mplex* = ref object of Muxer
|
||||||
remote*: Table[uint, LPChannel]
|
remote*: Table[uint, LPChannel]
|
||||||
@ -71,7 +69,7 @@ method handle*(m: Mplex) {.async, gcsafe.} =
|
|||||||
while not m.connection.closed:
|
while not m.connection.closed:
|
||||||
trace "waiting for data"
|
trace "waiting for data"
|
||||||
let
|
let
|
||||||
res = await one(m.connection.readMsg(), messageTimeout(HandleTimeout))
|
res = await one(m.connection.readMsg(), messageTimeout(MaxReadWriteTime))
|
||||||
msg = res.read()
|
msg = res.read()
|
||||||
if msg.isNone:
|
if msg.isNone:
|
||||||
trace "connection EOF"
|
trace "connection EOF"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user