-
Matthias Gerstner authored
This function only closes the socket on success, i.e. for each unsuccessful bind attempt a socket "leaks". It does not actually leak, because the Python interface implements reference counting. Still it is unclean, because after successful bind the socket is explicitly closed. So either the application is responsible for closing the socket, or not. Since it is better not to rely on the implementation of the Python interpreter and the socket module it should be prefered to always explicitly close the socket. Also this function opens a new socket for each port to try. This is inefficient, since the same socket can be reused for testing. Therefore only open and close a single socket.
8a71316e