Skip to content

Commit

Permalink
Fix #432: deal with inability to find port correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
teodesian committed Oct 22, 2019
1 parent d4065ff commit 8b83cf1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Revision history for Selenium-Remote-Driver

1.35 10-21-2019 TEODESIAN
[BUG FIXES]
- Fix race condition and inability to find a port in certain circumstances when using direct driver modules.

1.34 09-11-2019 TEODESIAN
[BUG FIXES]
- Remove .so files from Firefox lib tree to simplify CPAN RPM build tool chains
Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = Selenium-Remote-Driver
version = 1.34
version = 1.35
author = George S. Baugh <george@troglodyne.net>
author = Aditya Ivaturi <ivaturi@gmail.com>
author = Daniel Gempesaw <gempesaw@gmail.com>
Expand Down
18 changes: 5 additions & 13 deletions lib/Selenium/CanStartBinary/ProbePort.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,11 @@ our @EXPORT_OK = qw/find_open_port_above find_open_port probe_port/;
=cut

sub find_open_port_above {
my ($port) = @_;

my $free_port = wait_until {
if ( probe_port($port) ) {
$port++;
return 0;
}
else {
return $port;
}
};

return $free_port;
socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname("tcp"));
bind(SOCK, sockaddr_in(0, INADDR_ANY));
my $port = (sockaddr_in(getsockname(SOCK)))[0];
close(SOCK);
return $port;
}

sub find_open_port {
Expand Down

0 comments on commit 8b83cf1

Please sign in to comment.