Class: Thin::Backends::UnixServer

### Home Classes Methods

### In Files

- lib/thin/backends/unix_server.rb

### Parent

Thin::Backends::Base

### Methods

- ::new
- #close
- #connect
- #disconnect
- #remove_socket_file
- #to_s

### Class/Module Index

Quicksearch

- Thin
- Thin::Backends
- Thin::Backends::Base
- Thin::Backends::SwiftiplyClient
- Thin::Backends::TcpServer
- Thin::Backends::UnixServer
- Thin::Command
- Thin::Connection
- Thin::Controllers
- Thin::Controllers::Cluster
- Thin::Controllers::Controller
- Thin::Controllers::Service
- Thin::Daemonizable
- Thin::Daemonizable::ClassMethods
- Thin::Headers
- Thin::InvalidOption
- Thin::InvalidRequest
- Thin::Logging
- Thin::Logging::SimpleFormatter
- Thin::OptionRequired
- Thin::PidFileExist
- Thin::PidFileNotFound
- Thin::PlatformNotSupported
- Thin::Request
- Thin::Response
- Thin::RestartTimeout
- Thin::Runner
- Thin::RunnerError
- Thin::Server
- Thin::Stats
- Thin::Stats::Adapter
- Thin::SwiftiplyConnection
- Thin::UnixConnection
- Rack
- Rack::Adapter
- Rack::Adapter::Rails
- Rack::Adapter::Rails::CGIWrapper
- Rack::Adapter::Rails::CgiApp
- Rack::AdapterNotFound
- Process

No matching classes.

# Thin::Backends::UnixServer

Backend to act as a UNIX domain socket server.

### Attributes

socket[RW]

UNIX domain socket on which the server is listening for connections.

### Public Class Methods

new(socket) click to toggle source

    # File lib/thin/backends/unix_server.rb, line 8
    def initialize(socket)
      raise PlatformNotSupported, 'UNIX domain sockets not available on Windows' if Thin.win?
      @socket = socket
      super()
    end

### Public Instance Methods

close() click to toggle source

Free up resources used by the backend.

    # File lib/thin/backends/unix_server.rb, line 34
    def close
      remove_socket_file
    end

connect() click to toggle source

Connect the server

    # File lib/thin/backends/unix_server.rb, line 15
    def connect
      at_exit { remove_socket_file } # In case it crashes
      old_umask = File.umask(0)
      begin
        EventMachine.start_unix_domain_server(@socket, UnixConnection, &method(:initialize_connection))
        # HACK EventMachine.start_unix_domain_server doesn't return the connection signature
        #      so we have to go in the internal stuff to find it.
      @signature = EventMachine.instance_eval{@acceptors.keys.first}
      ensure
        File.umask(old_umask)
      end
    end

disconnect() click to toggle source

Stops the server

    # File lib/thin/backends/unix_server.rb, line 29
    def disconnect
      EventMachine.stop_server(@signature)
    end

to_s() click to toggle source

    # File lib/thin/backends/unix_server.rb, line 38
    def to_s
      @socket
    end

### Protected Instance Methods

remove_socket_file() click to toggle source

    # File lib/thin/backends/unix_server.rb, line 43
    def remove_socket_file
      File.delete(@socket) if @socket && File.exist?(@socket)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.