Module: Hatetepe::Connection
Instance Attribute Summary collapse
-
#processing_enabled ⇒ Object
(also: #processing_enabled?)
Returns the value of attribute processing_enabled.
Instance Method Summary collapse
- #close_connection(after_writing = false) ⇒ Object
- #closed? ⇒ Boolean
- #closed_by_connect_timeout? ⇒ Boolean
- #closed_by_remote? ⇒ Boolean
- #closed_by_self? ⇒ Boolean
- #closed_by_timeout? ⇒ Boolean
- #comm_inactivity_timeout=(seconds) ⇒ Object
- #connected? ⇒ Boolean
- #connection_completed ⇒ Object
- #pending_connect_timeout=(seconds) ⇒ Object
- #remote_address ⇒ Object
- #remote_port ⇒ Object
- #sockaddr ⇒ Object
- #unbind(reason) ⇒ Object
Instance Attribute Details
#processing_enabled ⇒ Object Also known as: processing_enabled?
Returns the value of attribute processing_enabled.
3 4 5 |
# File 'lib/hatetepe/connection.rb', line 3 def processing_enabled @processing_enabled end |
Instance Method Details
#close_connection(after_writing = false) ⇒ Object
46 47 48 49 |
# File 'lib/hatetepe/connection.rb', line 46 def close_connection(after_writing = false) @closed_by = :self unless closed? super end |
#closed? ⇒ Boolean
26 27 28 |
# File 'lib/hatetepe/connection.rb', line 26 def closed? !!defined?(@closed_by) end |
#closed_by_connect_timeout? ⇒ Boolean
42 43 44 |
# File 'lib/hatetepe/connection.rb', line 42 def closed_by_connect_timeout? !connected? && @closed_by == :timeout end |
#closed_by_remote? ⇒ Boolean
30 31 32 |
# File 'lib/hatetepe/connection.rb', line 30 def closed_by_remote? @closed_by == :remote end |
#closed_by_self? ⇒ Boolean
34 35 36 |
# File 'lib/hatetepe/connection.rb', line 34 def closed_by_self? @closed_by == :self end |
#closed_by_timeout? ⇒ Boolean
38 39 40 |
# File 'lib/hatetepe/connection.rb', line 38 def closed_by_timeout? connected? && @closed_by == :timeout end |
#comm_inactivity_timeout=(seconds) ⇒ Object
61 62 63 64 65 |
# File 'lib/hatetepe/connection.rb', line 61 def comm_inactivity_timeout=(seconds) unless defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" super end end |
#connected? ⇒ Boolean
22 23 24 |
# File 'lib/hatetepe/connection.rb', line 22 def connected? defined?(@connected) && @connected end |
#connection_completed ⇒ Object
18 19 20 |
# File 'lib/hatetepe/connection.rb', line 18 def connection_completed @connected = true end |
#pending_connect_timeout=(seconds) ⇒ Object
67 68 69 70 71 |
# File 'lib/hatetepe/connection.rb', line 67 def pending_connect_timeout=(seconds) unless defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" super end end |
#remote_address ⇒ Object
6 7 8 |
# File 'lib/hatetepe/connection.rb', line 6 def remote_address sockaddr && sockaddr[1] end |
#remote_port ⇒ Object
10 11 12 |
# File 'lib/hatetepe/connection.rb', line 10 def remote_port sockaddr && sockaddr[0] end |
#sockaddr ⇒ Object
14 15 16 |
# File 'lib/hatetepe/connection.rb', line 14 def sockaddr @sockaddr ||= Socket.unpack_sockaddr_in(get_peername) rescue nil end |
#unbind(reason) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/hatetepe/connection.rb', line 51 def unbind(reason) unless closed? @closed_by = if reason == Errno::ETIMEDOUT :timeout else :remote end end end |