use raises defect
This commit is contained in:
parent
ce42674d80
commit
b56ca11b74
|
@ -107,7 +107,7 @@ method upgradeOutgoing*(
|
||||||
|
|
||||||
method upgradeIncoming*(
|
method upgradeIncoming*(
|
||||||
self: MuxedUpgrade,
|
self: MuxedUpgrade,
|
||||||
incomingConn: Connection): Future[void] {.async, gcsafe.} = # noraises
|
incomingConn: Connection) {.async, gcsafe.} = # noraises
|
||||||
trace "Upgrading incoming connection", incomingConn
|
trace "Upgrading incoming connection", incomingConn
|
||||||
let ms = newMultistream()
|
let ms = newMultistream()
|
||||||
|
|
||||||
|
@ -208,24 +208,23 @@ proc init*(
|
||||||
connManager: connManager,
|
connManager: connManager,
|
||||||
ms: ms)
|
ms: ms)
|
||||||
|
|
||||||
proc streamHandler(conn: Connection) {.async, gcsafe.} = # noraises
|
upgrader.streamHandler = proc(conn: Connection)
|
||||||
# trace "Starting stream handler", conn
|
{.async, gcsafe, raises: [Defect].} =
|
||||||
try:
|
trace "Starting stream handler", conn
|
||||||
await upgrader.ms.handle(conn) # handle incoming connection
|
try:
|
||||||
except CancelledError as exc:
|
await upgrader.ms.handle(conn) # handle incoming connection
|
||||||
raise exc
|
except CancelledError as exc:
|
||||||
except CatchableError as exc:
|
raise exc
|
||||||
# trace "exception in stream handler", conn, msg = exc.msg
|
except CatchableError as exc:
|
||||||
discard
|
trace "exception in stream handler", conn, msg = exc.msg
|
||||||
finally:
|
finally:
|
||||||
await conn.closeWithEOF()
|
await conn.closeWithEOF()
|
||||||
# trace "Stream handler done", conn
|
trace "Stream handler done", conn
|
||||||
|
|
||||||
upgrader.streamHandler = streamHandler
|
|
||||||
|
|
||||||
for _, val in muxers:
|
for _, val in muxers:
|
||||||
val.streamHandler = upgrader.streamHandler
|
val.streamHandler = upgrader.streamHandler
|
||||||
val.muxerHandler = proc(muxer: Muxer): Future[void] =
|
val.muxerHandler = proc(muxer: Muxer): Future[void]
|
||||||
|
{.raises: [Defect].} =
|
||||||
upgrader.muxerHandler(muxer)
|
upgrader.muxerHandler(muxer)
|
||||||
|
|
||||||
return upgrader
|
return upgrader
|
||||||
|
|
Loading…
Reference in New Issue