From aa15313aa8c133f9a23a3175a930d2ea7cb82f59 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Tue, 3 Jul 2018 08:35:45 +0300 Subject: [PATCH] Fix: Windows handle error on disconnect. --- asyncdispatch2/transports/stream.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/asyncdispatch2/transports/stream.nim b/asyncdispatch2/transports/stream.nim index 0882833c..2f113536 100644 --- a/asyncdispatch2/transports/stream.nim +++ b/asyncdispatch2/transports/stream.nim @@ -312,11 +312,14 @@ when defined(windows): transp.state.incl(ReadPaused) elif int(err) == ERROR_OPERATION_ABORTED: # CancelIO() interrupt - discard + transp.state.incl(ReadPaused) + elif int(err) == ERROR_NETNAME_DELETED: + transp.state.incl({ReadEof, ReadPaused}) else: transp.setReadError(err) if not isNil(transp.reader): - transp.finishReader() + if not transp.reader.finished: + transp.finishReader() if ReadPaused in transp.state: # Transport buffer is full, so we will not continue on reading. break