Open kadler opened 4 years ago
SLIC maps SO_REUSEPORT to SO_REUSEADDR
This behavior can be seen from the repl:
>>> import socket
>>> sock = socket.socket()
>>> sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)
0
>>> sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT)
0
>>> sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
>>> sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)
1
>>> sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT)
1
and vice versa
>>> import socket
>>> sock = socket.socket()
>>> sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)
0
>>> sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT)
0
>>> sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
>>> sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT)
1
>>> sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)
1
Sets reuse_port=True
and then asserts SO_REUSEADDR
is false aka 0. Well since SO_REUSEPORT
gets set to 1
so does SO_REUSEADDR
on IBM i.
within socket.create_server tries to set the SO_REUSEADDR
option which in turn enables SO_REUSEPORT
. So the assert within the test case fails here expecting SO_REUSEPORT
to be false we in reality its set on by enables SO_REUSEADDR
in socket.creat_server
@kadler
To work around these assertion failures should add conditionals for IBM i that assert that opposite of the failures?