diff --git a/dtls/demux/__init__.py b/dtls/demux/__init__.py index 4c88f1a..ee53ba6 100644 --- a/dtls/demux/__init__.py +++ b/dtls/demux/__init__.py @@ -21,6 +21,7 @@ import sys if sys.platform.startswith('win') or sys.platform.startswith('cygwin'): from router import UDPDemux else: - from osnet import UDPDemux + #from osnet import UDPDemux + from router import UDPDemux __all__ = ["UDPDemux"] diff --git a/dtls/openssl.py b/dtls/openssl.py index 519d587..0c63d1f 100644 --- a/dtls/openssl.py +++ b/dtls/openssl.py @@ -616,9 +616,9 @@ def SSL_CTX_set_read_ahead(ctx, m): # Returns the previous value of m _SSL_CTX_ctrl(ctx, SSL_CTRL_SET_READ_AHEAD, m, None) -_rint_voidp_ubytep_uintp = CFUNCTYPE(c_int, c_void_p, POINTER(c_ubyte), +_rint_voidp_ubytep_uintp = CFUNCTYPE(c_int, c_int, POINTER(c_ubyte), POINTER(c_uint)) -_rint_voidp_ubytep_uint = CFUNCTYPE(c_int, c_void_p, POINTER(c_ubyte), c_uint) +_rint_voidp_ubytep_uint = CFUNCTYPE(c_int, c_int, POINTER(c_ubyte), c_uint) def SSL_CTX_set_cookie_cb(ctx, generate, verify): def py_generate_cookie_cb(ssl, cookie, cookie_len): diff --git a/dtls/test/unit.py b/dtls/test/unit.py index b585889..8cedc39 100644 --- a/dtls/test/unit.py +++ b/dtls/test/unit.py @@ -154,10 +154,14 @@ class BasicSocketTests(unittest.TestCase): # something unexpected like TypeError. s = socket.socket(AF_INET4_6, socket.SOCK_DGRAM) ss = ssl.wrap_socket(s) - self.assertRaises(socket.error, ss.recv, 1) - self.assertRaises(socket.error, ss.recv_into, bytearray(b'x')) - self.assertRaises(socket.error, ss.recvfrom, 1) - self.assertRaises(socket.error, ss.recvfrom_into, bytearray(b'x'), 1) + if os.name != "posix": + # On Linux, unconnected, unbound datagram sockets can receive and + # the following calls will therefore block + self.assertRaises(socket.error, ss.recv, 1) + self.assertRaises(socket.error, ss.recv_into, bytearray(b'x')) + self.assertRaises(socket.error, ss.recvfrom, 1) + self.assertRaises(socket.error, ss.recvfrom_into, bytearray(b'x'), + 1) self.assertRaises(socket.error, ss.send, b'x') self.assertRaises(socket.error, ss.sendto, b'x', ('0.0.0.0', 0) if AF_INET4_6 == socket.AF_INET else