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
Instance Method Summary collapse
-
#initialize(agt, st) ⇒ ReadIOLapper
constructor
A new instance of ReadIOLapper.
- #lap ⇒ Object
- #next ⇒ Object
Methods inherited from Lapper
Constructor Details
#initialize(agt, st) ⇒ ReadIOLapper
Returns a new instance of ReadIOLapper.
49 50 51 52 53 |
# File 'lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb', line 49 def initialize(agt, st) super(st) @agent = agt st.rudder.set_non_blocking end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
47 48 49 |
# File 'lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb', line 47 def agent @agent end |
Instance Method Details
#lap ⇒ Object
55 56 57 58 59 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 |
# File 'lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb', line 55 def lap spun = false begin infile = @state.rudder.io eof = false begin n = @state.rudder.read(@state.read_buf, @state.buf_size) #infile.sysread(@state.buf_size, @state.read_buf) rescue EOFError => e @state.read_buf.clear eof = true 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, @state.read_buf.length, nil, false) return false rescue Exception => e @agent.send_error_letter(@state, e, false) return false end end |
#next ⇒ Object
90 91 92 |
# File 'lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb', line 90 def next end |