Class: LiveConsole::IOMethods::UnixSocketConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/live_console/io_methods/unix_socket/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server, opts) ⇒ UnixSocketConnection

Returns a new instance of UnixSocketConnection.



7
8
9
10
# File 'lib/live_console/io_methods/unix_socket/connection.rb', line 7

def initialize(server, opts)
  @server = server
  @opts = opts
end

Instance Attribute Details

#raw_inputObject

Returns the value of attribute raw_input.



5
6
7
# File 'lib/live_console/io_methods/unix_socket/connection.rb', line 5

def raw_input
  @raw_input
end

#raw_outputObject

Returns the value of attribute raw_output.



5
6
7
# File 'lib/live_console/io_methods/unix_socket/connection.rb', line 5

def raw_output
  @raw_output
end

Instance Method Details

#authenticateObject



33
34
35
# File 'lib/live_console/io_methods/unix_socket/connection.rb', line 33

def authenticate
  true
end

#selectObject



29
30
31
# File 'lib/live_console/io_methods/unix_socket/connection.rb', line 29

def select
  IO.select [@server], [], [], 1 if @server
end

#startObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/live_console/io_methods/unix_socket/connection.rb', line 12

def start
  begin
    self.raw_input = self.raw_output = @server.accept_nonblock
    raw_input.sync = true
    return true
  rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO,
    Errno::EINTR => e
    select
    retry
  end
end

#stopObject



24
25
26
27
# File 'lib/live_console/io_methods/unix_socket/connection.rb', line 24

def stop
  select
  raw_input.close
end