mirror of https://github.com/vacp2p/nim-libp2p.git
end multiplex read loop on exception
This commit is contained in:
parent
cc2072d290
commit
68eb142a7c
|
@ -136,13 +136,14 @@ proc handle*(m: MultisteamSelect, conn: Connection) {.async, gcsafe.} =
|
||||||
else:
|
else:
|
||||||
for h in m.handlers:
|
for h in m.handlers:
|
||||||
if (not isNil(h.match) and h.match(ms)) or ms == h.proto:
|
if (not isNil(h.match) and h.match(ms)) or ms == h.proto:
|
||||||
trace "found handler for", protocol = ms
|
trace "found handler for", protocol = ms
|
||||||
await conn.writeLp((h.proto & "\n"))
|
await conn.writeLp((h.proto & "\n"))
|
||||||
try:
|
try:
|
||||||
await h.protocol.handler(conn, ms)
|
await h.protocol.handler(conn, ms)
|
||||||
return
|
return
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
warn "exception while handling ", msg = exc.msg
|
warn "exception while handling ", msg = exc.msg
|
||||||
|
return
|
||||||
warn "no handlers for ", protocol = ms
|
warn "no handlers for ", protocol = ms
|
||||||
await conn.write(m.na)
|
await conn.write(m.na)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue