From 1350d5312b248128582db6d2ebde8d7ce5349e48 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Wed, 7 Sep 2016 12:19:06 +0300 Subject: Removed tests with `asyncio`. Fix ssl connection drop in asyncnet Add tasyncssl test --- lib/pure/asyncnet.nim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index dbf895d18..334f95baa 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -165,9 +165,14 @@ when defineSsl: await sendPendingSslData(socket, flags) of SSL_ERROR_WANT_READ: var data = await recv(socket.fd.AsyncFD, BufferSize, flags) - let ret = bioWrite(socket.bioIn, addr data[0], data.len.cint) - if ret < 0: - raiseSSLError() + let length = len(data) + if length > 0: + let ret = bioWrite(socket.bioIn, addr data[0], data.len.cint) + if ret < 0: + raiseSSLError() + elif length == 0: + # connection not properly closed by remote side or connection dropped + SSL_set_shutdown(socket.sslHandle, SSL_RECEIVED_SHUTDOWN) else: raiseSSLError("Cannot appease SSL.") -- cgit 1.4.1-2-gfad0