Class: Proxi::Connection
- Inherits:
-
Object
- Object
- Proxi::Connection
- Includes:
- Wisper::Publisher
- Defined in:
- lib/proxi/connection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#in_socket ⇒ Object
readonly
Returns the value of attribute in_socket.
-
#remote_host ⇒ Object
readonly
Returns the value of attribute remote_host.
-
#remote_port ⇒ Object
readonly
Returns the value of attribute remote_port.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #call ⇒ Object
-
#initialize(in_socket, remote_host, remote_port) ⇒ Connection
constructor
A new instance of Connection.
- #join_thread ⇒ Object
Constructor Details
#initialize(in_socket, remote_host, remote_port) ⇒ Connection
Returns a new instance of Connection.
7 8 9 10 11 |
# File 'lib/proxi/connection.rb', line 7 def initialize(in_socket, remote_host, remote_port) @in_socket = in_socket @remote_host, @remote_port = remote_host, remote_port @state = :new end |
Instance Attribute Details
#in_socket ⇒ Object (readonly)
Returns the value of attribute in_socket.
5 6 7 |
# File 'lib/proxi/connection.rb', line 5 def in_socket @in_socket end |
#remote_host ⇒ Object (readonly)
Returns the value of attribute remote_host.
5 6 7 |
# File 'lib/proxi/connection.rb', line 5 def remote_host @remote_host end |
#remote_port ⇒ Object (readonly)
Returns the value of attribute remote_port.
5 6 7 |
# File 'lib/proxi/connection.rb', line 5 def remote_port @remote_port end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
5 6 7 |
# File 'lib/proxi/connection.rb', line 5 def thread @thread end |
Instance Method Details
#alive? ⇒ Boolean
18 19 20 |
# File 'lib/proxi/connection.rb', line 18 def alive? thread.alive? end |
#call ⇒ Object
13 14 15 16 |
# File 'lib/proxi/connection.rb', line 13 def call broadcast(:start_connection, self) @thread = Thread.new { proxy_loop } end |
#join_thread ⇒ Object
22 23 24 |
# File 'lib/proxi/connection.rb', line 22 def join_thread thread.join end |