don't reraise just yet

This commit is contained in:
Dmitriy Ryajov 2020-05-14 09:19:03 -06:00
parent cf76edb0dd
commit bfe84816ac
1 changed files with 37 additions and 37 deletions

View File

@ -102,51 +102,51 @@ suite "Switch":
waitFor(testSwitch()) waitFor(testSwitch())
# test "e2e use switch no proto string": test "e2e use switch no proto string":
# proc testSwitch(): Future[bool] {.async, gcsafe.} = proc testSwitch(): Future[bool] {.async, gcsafe.} =
# let ma1: MultiAddress = Multiaddress.init("/ip4/0.0.0.0/tcp/0") let ma1: MultiAddress = Multiaddress.init("/ip4/0.0.0.0/tcp/0")
# let ma2: MultiAddress = Multiaddress.init("/ip4/0.0.0.0/tcp/0") let ma2: MultiAddress = Multiaddress.init("/ip4/0.0.0.0/tcp/0")
# var peerInfo1, peerInfo2: PeerInfo var peerInfo1, peerInfo2: PeerInfo
# var switch1, switch2: Switch var switch1, switch2: Switch
# var awaiters: seq[Future[void]] var awaiters: seq[Future[void]]
# (switch1, peerInfo1) = createSwitch(ma1) (switch1, peerInfo1) = createSwitch(ma1)
# proc handle(conn: Connection, proto: string) {.async, gcsafe.} = proc handle(conn: Connection, proto: string) {.async, gcsafe.} =
# let msg = cast[string](await conn.readLp(1024)) let msg = cast[string](await conn.readLp(1024))
# check "Hello!" == msg check "Hello!" == msg
# await conn.writeLp("Hello!") await conn.writeLp("Hello!")
# await conn.close() await conn.close()
# let testProto = new TestProto let testProto = new TestProto
# testProto.codec = TestCodec testProto.codec = TestCodec
# testProto.handler = handle testProto.handler = handle
# switch1.mount(testProto) switch1.mount(testProto)
# (switch2, peerInfo2) = createSwitch(ma2) (switch2, peerInfo2) = createSwitch(ma2)
# awaiters.add(await switch1.start()) awaiters.add(await switch1.start())
# awaiters.add(await switch2.start()) awaiters.add(await switch2.start())
# await switch2.connect(switch1.peerInfo) await switch2.connect(switch1.peerInfo)
# let conn = await switch2.dial(switch1.peerInfo, TestCodec) let conn = await switch2.dial(switch1.peerInfo, TestCodec)
# try: try:
# await conn.writeLp("Hello!") await conn.writeLp("Hello!")
# let msg = cast[string](await conn.readLp(1024)) let msg = cast[string](await conn.readLp(1024))
# check "Hello!" == msg check "Hello!" == msg
# result = true result = true
# except LPStreamError: except LPStreamError:
# result = false result = false
# await allFuturesThrowing( await allFuturesThrowing(
# conn.close(), conn.close(),
# switch1.stop(), switch1.stop(),
# switch2.stop() switch2.stop()
# ) )
# await allFuturesThrowing(awaiters) await allFuturesThrowing(awaiters)
# check: check:
# waitFor(testSwitch()) == true waitFor(testSwitch()) == true
# test "e2e: handle read + secio fragmented": # test "e2e: handle read + secio fragmented":
# proc testListenerDialer(): Future[bool] {.async.} = # proc testListenerDialer(): Future[bool] {.async.} =