Skip to content
Myr

Fix creating non-listening sockets in tests on some platforms (#5890)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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.

authored by Michał Górny · committed by GitHub · parent db575ee · Browse files · 1 file+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−1 removed

  • tests:+3 added−1 removed

1 file+3 added−1 removed

modified:tests/testserver/server.py+3 added-1 removed
76 unmodified lines
7778 def _create_socket_and_bind(self):79 sock = socket.socket()80 sock.bind((self.host, self.port))81 # NB: when Python 2.7 is no longer supported, the argument82 # can be removed to use a default backlog size81 sock.listen(0)83 sock.listen(5)84 return sock8586 def _close_server_sock_ignore_errors(self):87 try:
43 unmodified lines