Class: Baykit::BayServer::Agent::Multiplexer::SpinMultiplexer::ReadIOLapper
- Inherits:
-
Lapper
- Object
- Lapper
- Baykit::BayServer::Agent::Multiplexer::SpinMultiplexer::ReadIOLapper
- Defined in:
- lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
Attributes inherited from Lapper
#last_access, #multiplexer, #state, #state_id
Instance Method Summary collapse
-
#initialize(mpx, agt, st) ⇒ ReadIOLapper
constructor
A new instance of ReadIOLapper.
- #lap ⇒ Object
- #next ⇒ Object
Methods inherited from Lapper
Constructor Details
#initialize(mpx, agt, st) ⇒ ReadIOLapper
Returns a new instance of ReadIOLapper.
54 55 56 57 58 |
# File 'lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb', line 54 def initialize(mpx, agt, st) super(mpx, st) @agent = agt st.rudder.set_non_blocking end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
52 53 54 |
# File 'lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb', line 52 def agent @agent end |
Instance Method Details
#lap ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb', line 60 def lap spun = false begin infile = @state.rudder.io eof = false begin n = @state.rudder.read(@state.read_buf, @state.buf_size) if n == 0 eof = true end rescue Errno::EAGAIN => e BayLog.debug("%s %s", @agent, e) return true end if @state.read_buf.length == 0 if !eof return true else BayLog.debug("%s Spin read: EOF\\(^o^)/ rd=%s", @agent, infile) end end @agent.send_read_letter(@state_id, @state.rudder, @multiplexer, @state.read_buf.length, nil, false) return false rescue Exception => e @agent.send_error_letter(@state_id, @state.rudder, @multiplexer, e, false) return false end end |
#next ⇒ Object
94 95 96 |
# File 'lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb', line 94 def next end |