Skip to content

Commit

Permalink
Correct wrap_socket call for Python 3.12
Browse files Browse the repository at this point in the history
Signed-off-by: Aarni Koskela <[email protected]>
  • Loading branch information
akx committed Dec 21, 2023
1 parent d89f66e commit 4bbc08f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/paho_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ def create_server_socket_ssl(*args, **kwargs):

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
ssock = ssl.wrap_socket(
sock, ca_certs="../ssl/all-ca.crt",
keyfile="../ssl/server.key", certfile="../ssl/server.crt",
server_side=True, ssl_version=ssl_version, **kwargs)
context = ssl.SSLContext(ssl_version)
context.load_verify_locations("../ssl/all-ca.crt")
context.load_cert_chain("../ssl/server.crt", "../ssl/server.key")

ssock = context.wrap_socket(
sock,
server_side=True,
**kwargs,
)
ssock.settimeout(10)
ssock.bind(('', 1888))
ssock.listen(5)
Expand Down

0 comments on commit 4bbc08f

Please sign in to comment.