From 36d6b71a4bcf476f3acda6b249486844d76128ef Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 13 Oct 2013 01:38:24 +0000 Subject: use shorter socket constants for sockets This is to be compatible with Rubinius, but also works with MRI. --- lib/dtas/unix_client.rb | 2 +- lib/dtas/unix_server.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/dtas/unix_client.rb b/lib/dtas/unix_client.rb index fa8b11c..dfde59b 100644 --- a/lib/dtas/unix_client.rb +++ b/lib/dtas/unix_client.rb @@ -17,7 +17,7 @@ class DTAS::UNIXClient # :nodoc: end def initialize(path = self.class.default_path) - @to_io = Socket.new(:AF_UNIX, :SOCK_SEQPACKET, 0) + @to_io = Socket.new(:UNIX, :SEQPACKET, 0) @to_io.connect(Socket.pack_sockaddr_un(path)) end diff --git a/lib/dtas/unix_server.rb b/lib/dtas/unix_server.rb index bccfad5..21261d3 100644 --- a/lib/dtas/unix_server.rb +++ b/lib/dtas/unix_server.rb @@ -26,13 +26,13 @@ class DTAS::UNIXServer # :nodoc: # lock down access by default, arbitrary commands may run as the # same user dtas-player runs as: old_umask = File.umask(0077) - @to_io = Socket.new(:AF_UNIX, :SOCK_SEQPACKET, 0) + @to_io = Socket.new(:UNIX, :SEQPACKET, 0) addr = Socket.pack_sockaddr_un(path) begin @to_io.bind(addr) rescue Errno::EADDRINUSE # maybe we have an old path leftover from a killed process - tmp = Socket.new(:AF_UNIX, :SOCK_SEQPACKET, 0) + tmp = Socket.new(:UNIX, :SEQPACKET, 0) begin tmp.connect(addr) raise RuntimeError, "socket `#{path}' is in use", [] -- cgit v1.2.3-24-ge0c7