Class: Thin::Backends::UnixServer

Class Thin::Backends::UnixServer < Base

(in files lib/thin/backends/unix_server.rb )

Backend to act as a UNIX domain socket server.

Methods

Public Class new(socket)

    # 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 close()

Free up resources used by the backend.

    # File lib/thin/backends/unix_server.rb, line 29
29:       def close
30:         remove_socket_file
31:       end

Public Instance connect()

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:         EventMachine.start_unix_domain_server(@socket, UnixConnection, &method(:initialize_connection))
18:         # HACK EventMachine.start_unix_domain_server doesn't return the connection signature
19:         #      so we have to go in the internal stuff to find it.
20:         @signature = EventMachine.instance_eval{@acceptors.keys.first}
21:       end

Public Instance disconnect()

Stops the server

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

Public Instance to_s()

    # File lib/thin/backends/unix_server.rb, line 33
33:       def to_s
34:         @socket
35:       end

Protected Instance remove_socket_file()

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