lib/celluloid/io/unix_server.rb in celluloid-io-0.16.5.pre0 vs lib/celluloid/io/unix_server.rb in celluloid-io-0.17.0
- old
+ new
@@ -10,10 +10,20 @@
def self.open(socket_path)
self.new(socket_path)
end
def initialize(socket_path)
- @server = ::UNIXServer.new(socket_path)
+ begin
+ @server = ::UNIXServer.new(socket_path)
+ rescue => ex
+ # Translate the EADDRINUSE jRuby exception.
+ raise unless RUBY_PLATFORM == 'java'
+ if ex.class.name == "IOError" && # Won't agree to .is_a?(IOError)
+ ex.message.include?("in use")
+ raise Errno::EADDRINUSE.new(ex.message)
+ end
+ raise
+ end
end
def accept
Celluloid::IO.wait_readable(@server)
accept_nonblock