SecioConn.readMessage(): fix the exception types

This commit is contained in:
Ștefan Talpalaru 2020-04-02 19:07:14 +02:00
parent 5285f0d091
commit 7f8090b166
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 5 additions and 4 deletions

View File

@ -195,9 +195,9 @@ method readMessage(sconn: SecioConn): Future[seq[byte]] {.async.} =
else: else:
trace "Received message header size is more then allowed", trace "Received message header size is more then allowed",
length = length, allowed_length = SecioMaxMessageSize length = length, allowed_length = SecioMaxMessageSize
except AsyncStreamIncompleteError: except LPStreamIncompleteError:
trace "Connection dropped while reading" trace "Connection dropped while reading"
except AsyncStreamReadError: except LPStreamReadError:
trace "Error reading from connection" trace "Error reading from connection"
method writeMessage(sconn: SecioConn, message: seq[byte]) {.async.} = method writeMessage(sconn: SecioConn, message: seq[byte]) {.async.} =

View File

@ -465,7 +465,7 @@ suite "BufferStream":
waitFor(pipeTest()) == true waitFor(pipeTest()) == true
test "shouldn't get stuck on close": 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] = proc createMessage(tmplate: string, size: int): seq[byte] =
result = newSeq[byte](size) result = newSeq[byte](size)
for i in 0 ..< len(result): for i in 0 ..< len(result):
@ -482,4 +482,5 @@ suite "BufferStream":
result = false result = false
check: check:
waitFor(test()) == true waitFor(closeTest()) == true