Skip to content

Commit 8b83cf1

Browse files
committed
Fix #432: deal with inability to find port correctly
1 parent d4065ff commit 8b83cf1

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Revision history for Selenium-Remote-Driver
22

3+
1.35 10-21-2019 TEODESIAN
4+
[BUG FIXES]
5+
- Fix race condition and inability to find a port in certain circumstances when using direct driver modules.
6+
37
1.34 09-11-2019 TEODESIAN
48
[BUG FIXES]
59
- Remove .so files from Firefox lib tree to simplify CPAN RPM build tool chains

dist.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = Selenium-Remote-Driver
2-
version = 1.34
2+
version = 1.35
33
author = George S. Baugh <[email protected]>
44
author = Aditya Ivaturi <[email protected]>
55
author = Daniel Gempesaw <[email protected]>

lib/Selenium/CanStartBinary/ProbePort.pm

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,11 @@ our @EXPORT_OK = qw/find_open_port_above find_open_port probe_port/;
1717
=cut
1818

1919
sub find_open_port_above {
20-
my ($port) = @_;
21-
22-
my $free_port = wait_until {
23-
if ( probe_port($port) ) {
24-
$port++;
25-
return 0;
26-
}
27-
else {
28-
return $port;
29-
}
30-
};
31-
32-
return $free_port;
20+
socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname("tcp"));
21+
bind(SOCK, sockaddr_in(0, INADDR_ANY));
22+
my $port = (sockaddr_in(getsockname(SOCK)))[0];
23+
close(SOCK);
24+
return $port;
3325
}
3426

3527
sub find_open_port {

0 commit comments

Comments
 (0)