class PhusionPassenger::RequestHandler
def create_unix_socket_on_filesystem(options)
def create_unix_socket_on_filesystem(options) if defined?(NativeSupport) unix_path_max = NativeSupport::UNIX_PATH_MAX else unix_path_max = options.fetch('UNIX_PATH_MAX', 100).to_i end if options['socket_dir'] socket_dir = options['socket_dir'] socket_prefix = "ruby" else socket_dir = Dir.tmpdir socket_prefix = "PsgRubyApp" end retry_at_most(128, Errno::EADDRINUSE) do socket_address = "#{socket_dir}/#{socket_prefix}.#{generate_random_id(:base64)}" socket_address = socket_address.slice(0, unix_path_max - 10) socket = UNIXServer.new(socket_address) socket.listen(BACKLOG_SIZE) socket.binmode socket.sync = true socket.close_on_exec! File.chmod(0600, socket_address) ["unix:#{socket_address}", socket] end end