summaryrefslogtreecommitdiff
path: root/OpenSSL/SSL.py
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@twistedmatrix.com>2014-02-02 06:40:54 -0800
committerJean-Paul Calderone <exarkun@twistedmatrix.com>2014-02-02 06:40:54 -0800
commitce27d79ec1d93dd428d09f5e6df79b12534423a3 (patch)
treee4cd1d95ad08951387bed3e9c1be3c16438f11f8 /OpenSSL/SSL.py
parentdf454990b0c25a7a39d717328f384eb71128aba3 (diff)
parent541150de73400d0fea36e241ea76a34596996347 (diff)
downloadpyopenssl-ce27d79ec1d93dd428d09f5e6df79b12534423a3.tar.gz
Merge pull request #25 from longaccess/fix_test_closed
Use `getwinerror` to look up a syscall error code on Windows. Fixes `test_closed` on Windows.
Diffstat (limited to 'OpenSSL/SSL.py')
-rw-r--r--OpenSSL/SSL.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py
index ce2cc29..811c4de 100644
--- a/OpenSSL/SSL.py
+++ b/OpenSSL/SSL.py
@@ -1,4 +1,4 @@
-
+from sys import platform
from functools import wraps, partial
from itertools import count
from weakref import WeakValueDictionary
@@ -856,8 +856,11 @@ class Connection(object):
elif error == _lib.SSL_ERROR_SYSCALL:
if _lib.ERR_peek_error() == 0:
if result < 0:
- raise SysCallError(
- _ffi.errno, errorcode[_ffi.errno])
+ if platform == "win32":
+ errno = _ffi.getwinerror()[0]
+ else:
+ errno = _ffi.errno
+ raise SysCallError(errno, errorcode[errno])
else:
raise SysCallError(-1, "Unexpected EOF")
else: