From 84592548fa16d630be09f9e063d3678bb1a7831a Mon Sep 17 00:00:00 2001 From: Tesfa Mael Date: Thu, 29 Oct 2020 16:15:55 -0700 Subject: [PATCH] Raise error when wolfSSL_write() returns 0 --- src/wolfssl/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wolfssl/__init__.py b/src/wolfssl/__init__.py index 8b4098c..27d1f2c 100644 --- a/src/wolfssl/__init__.py +++ b/src/wolfssl/__init__.py @@ -543,7 +543,8 @@ class SSLSocket(object): while sent < length: ret = self.write(data[sent:]) - if (ret < 0): + if (ret <= 0): + #expect to receive 0 when peer is reset or closed err = _lib.wolfSSL_get_error(self.native_object, 0) if err == _SSL_ERROR_WANT_WRITE: raise SSLWantWriteError()