Skip to content

Commit

Permalink
Fix creating non-listening sockets in tests on some platforms
Browse files Browse the repository at this point in the history
Fix the listen() invocation for the test server not to pass a backlog
value of zero.  The value of zero means no backlog which effectively
means that the socket can not accept any connections.  This does not
matter for the majority of platforms since the value is only advisory
and the platform tends to go with a bigger backlog anyway.  However,
a few platforms (e.g. alpha or riscv Linux) do take the value literally,
and therefore the tests fail since they are unable to connect to
the server.  Let Python use a 'default reasonable value' instead.
  • Loading branch information
mgorny committed Jul 28, 2021
1 parent db575ee commit 6552e53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/testserver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def run(self):
def _create_socket_and_bind(self):
sock = socket.socket()
sock.bind((self.host, self.port))
sock.listen(0)
sock.listen()
return sock

def _close_server_sock_ignore_errors(self):
Expand Down

0 comments on commit 6552e53

Please sign in to comment.