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].} =
|
||||||
|
trace "Starting stream handler", conn
|
||||||
try:
|
try:
|
||||||
await upgrader.ms.handle(conn) # handle incoming connection
|
await upgrader.ms.handle(conn) # handle incoming connection
|
||||||
except CancelledError as exc:
|
except CancelledError as exc:
|
||||||
raise exc
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
# trace "exception in stream handler", conn, msg = exc.msg
|
trace "exception in stream handler", conn, msg = exc.msg
|
||||||
discard
|
|
||||||
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