lib/selenium/webdriver/firefox/socket_lock.rb in selenium-webdriver-0.1.2 vs lib/selenium/webdriver/firefox/socket_lock.rb in selenium-webdriver-0.1.3.dev
- old
+ new
@@ -8,20 +8,10 @@
# @api private
#
class SocketLock
- #
- # Need to be really specific about what host to use
- #
- # On os x, "localhost" will resolve to 3 different addresses (see /etc/hosts).
- # Ruby will loop over these and happily bind to the same port on each one,
- # making it completely unusable for our purposes.
- #
-
- HOST = "127.0.0.1"
-
def initialize(port, timeout)
@port = port
@timeout = timeout
end
@@ -52,10 +42,10 @@
def release
@server && @server.close
end
def can_lock?
- @server = TCPServer.new(HOST, @port)
+ @server = TCPServer.new(Platform.localhost, @port)
ChildProcess.close_on_exec @server
true
rescue SocketError, Errno::EADDRINUSE => ex
$stderr.puts "#{self}: #{ex.message}" if $DEBUG