From 7f8090b1660385059996725776a98e7a9411de34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Thu, 2 Apr 2020 19:07:14 +0200 Subject: [PATCH] SecioConn.readMessage(): fix the exception types --- libp2p/protocols/secure/secio.nim | 4 ++-- tests/testbufferstream.nim | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libp2p/protocols/secure/secio.nim b/libp2p/protocols/secure/secio.nim index 4d57d80a0..0452feff4 100644 --- a/libp2p/protocols/secure/secio.nim +++ b/libp2p/protocols/secure/secio.nim @@ -195,9 +195,9 @@ method readMessage(sconn: SecioConn): Future[seq[byte]] {.async.} = else: trace "Received message header size is more then allowed", length = length, allowed_length = SecioMaxMessageSize - except AsyncStreamIncompleteError: + except LPStreamIncompleteError: trace "Connection dropped while reading" - except AsyncStreamReadError: + except LPStreamReadError: trace "Error reading from connection" method writeMessage(sconn: SecioConn, message: seq[byte]) {.async.} = diff --git a/tests/testbufferstream.nim b/tests/testbufferstream.nim index 2ea08219b..ee22096b0 100644 --- a/tests/testbufferstream.nim +++ b/tests/testbufferstream.nim @@ -465,7 +465,7 @@ suite "BufferStream": waitFor(pipeTest()) == true test "shouldn't get stuck on close": - proc test(): Future[bool] {.async.} = + proc closeTest(): Future[bool] {.async.} = proc createMessage(tmplate: string, size: int): seq[byte] = result = newSeq[byte](size) for i in 0 ..< len(result): @@ -482,4 +482,5 @@ suite "BufferStream": result = false check: - waitFor(test()) == true \ No newline at end of file + waitFor(closeTest()) == true +