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
 8:       def initialize(socket)
 9:         raise PlatformNotSupported, 'UNIX domain sockets not available on Windows' if Thin.win?
10:         @socket = socket
11:         super()
12:       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
34:       def close
35:         remove_socket_file
36:       end
connect() click to toggle source

Connect the server

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

Stops the server

    # File lib/thin/backends/unix_server.rb, line 29
29:       def disconnect
30:         EventMachine.stop_server(@signature)
31:       end
to_s() click to toggle source
    # File lib/thin/backends/unix_server.rb, line 38
38:       def to_s
39:         @socket
40:       end

Protected Instance Methods

remove_socket_file() click to toggle source
    # File lib/thin/backends/unix_server.rb, line 43
43:         def remove_socket_file
44:           File.delete(@socket) if @socket && File.exist?(@socket)
45:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.