Class: Procodile::ControlServer
- Inherits:
-
Object
- Object
- Procodile::ControlServer
- Defined in:
- lib/procodile/control_server.rb
Instance Method Summary collapse
-
#initialize(supervisor) ⇒ ControlServer
constructor
A new instance of ControlServer.
- #listen ⇒ Object
Constructor Details
#initialize(supervisor) ⇒ ControlServer
Returns a new instance of ControlServer.
7 8 9 |
# File 'lib/procodile/control_server.rb', line 7 def initialize(supervisor) @supervisor = supervisor end |
Instance Method Details
#listen ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/procodile/control_server.rb', line 11 def listen socket = UNIXServer.new(@supervisor.config.sock_path) Procodile.log nil, 'control', "Listening at #{@supervisor.config.sock_path}" loop do client = socket.accept session = ControlSession.new(@supervisor, client) while line = client.gets if response = session.receive_data(line.strip) client.puts response end end client.close end ensure FileUtils.rm_f(@supervisor.config.sock_path) end |