summaryrefslogtreecommitdiff
path: root/regress-driver
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2016-02-28 19:39:10 -0800
committerJon Schlueter <jon.schlueter@gmail.com>2016-02-29 07:15:35 -0500
commit01bc4db1bda42e980fbc4ee1885e48e408939829 (patch)
tree24b62ec05c034ba02129ead17d9681477e7fed0f /regress-driver
parentfdeccf80ed70820d74fcffd0b0f1443354b1338e (diff)
downloadgpsd-01bc4db1bda42e980fbc4ee1885e48e408939829.tar.gz
Makes fake.py's TCP and UDP port assignments parallel-compatible.
The current method for assigning ports uses a counter initialized to a constant. Although this works fine for multiple sessions managed by a single instance of fake.py, it fails miserably when running multiple parallel instances of fake.py. The fix is to allow the OS to assign the port numbers, since it's guaranteed to pick unused ports. In the TCP case, this is simply a matter of specifying 0 as the port, and then extracting the actual assigned port number with getsockname(). In the UDP case, it's more complicated since the port number being picked is actually for *gpsd's* end, which can't be done in a straightforward manner. The workaround, which was already being used to pick the control-socket port for gpsd, is to bind a socket with a reusable address, close it, and then assume that the port will remain available until gpsd grabs it. This change turns the existing code to do that into a function, with the socket type now being specifiable. TESTED: Ran all daemon tests in both TCP and UDP modes, on three versions of OSX as well as Linux, FreeBSD, and OpenBSD. Used default WRITE_PAD values except on OSX, where it was reduced to 1ms to save time. Signed-off-by: Jon Schlueter <jon.schlueter@gmail.com>
Diffstat (limited to 'regress-driver')
0 files changed, 0 insertions, 0 deletions