Class: Plux::Reactor::Worker
- Inherits:
-
Object
- Object
- Plux::Reactor::Worker
- Defined in:
- lib/plux/reactor.rb
Instance Method Summary collapse
-
#initialize(socket, q) ⇒ Worker
constructor
A new instance of Worker.
- #process ⇒ Object
Constructor Details
Instance Method Details
#process ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/plux/reactor.rb', line 57 def process stream = @socket.read_nonblock(Parser::STREAM_MAX_LEN, exception: false) return true if stream == :wait_readable msgs = @parser.decode(stream) last_msg = msgs.pop msgs.each{ |msg| @q << msg } if last_msg == Parser::LAST_MSG @socket.close return false end @q << last_msg true end |