Skip to content

Commit a68d2c6

Browse files
author
Alexey Gadzhiev
committed
Windows WSAEWOULDBLOCK added
1 parent f2fbcd3 commit a68d2c6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tarantool/connection.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ def __init__(self, host, port,
100100
if False than you have to call connect() manualy.
101101
'''
102102
if os.name == 'nt':
103-
libc = ctypes.windll(
103+
libc = ctypes.WinDLL(
104104
ctypes.util.find_library('Ws2_32'), use_last_error=True
105105
)
106106
else:
107107
libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
108108
recv = self._sys_recv = libc.recv
109109
recv.argtypes = [
110110
ctypes.c_int, ctypes.c_void_p, c_ssize_t, ctypes.c_int]
111-
recv.restype = c_ssize_t
111+
recv.restype = ctypes.c_int
112112
self.host = host
113113
self.port = port
114114
self.user = user
@@ -300,8 +300,11 @@ def check(): # Check that connection is alive
300300
err = ctypes.get_errno()
301301
else:
302302
err = ctypes.get_last_error()
303-
304-
if (retbytes < 0) and (err == errno.EAGAIN or err == errno.EWOULDBLOCK):
303+
304+
WWSAEWOULDBLOCK = 10035
305+
if (retbytes < 0) and (err == errno.EAGAIN or
306+
err == errno.EWOULDBLOCK or
307+
err == WWSAEWOULDBLOCK):
305308
ctypes.set_errno(0)
306309
return errno.EAGAIN
307310
else:

0 commit comments

Comments
 (0)