1. jython
  2. jython
  3. Pull requests

Pull requests

#18 Merged
Repository
indratalip
Branch
default
Repository
jython
Branch
default

Fixes test_httplib SourceAddressTest regression test

Author
  1. Indra Talip
Reviewers
Description

When the network resource is enabled the test_httplib SourceAddressTest starts a socket server listening on a random port, found via test_support.bind_port(), then connects to that server specifying a source from another random port, found via test_support.find_unused_port(). The implementation for bind_port() uses a static list of ports to choose from however will always return 54321 because of the late binding of the socket implementation to the underlying java.nio.channels.ServerSocketChannel or java.nio.channels.SocketChannel isn't done until a call to socket.listen() or socket.connect() hence the call to socket.bind(port) will always succeed for port 54321.

This change forces a new socket that is bound to port 0 and has listen() called on it to force allocation of a new ephemeral port from the OS. The socket is then closed and deleted.

Comments (1)