Class: RightSpeed::Processor::AcceptProcessor
- Defined in:
- lib/right_speed/processor.rb
Instance Method Summary collapse
- #configure(listener:) ⇒ Object
-
#initialize(workers, handler) ⇒ AcceptProcessor
constructor
A new instance of AcceptProcessor.
- #run ⇒ Object
- #wait ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(workers, handler) ⇒ AcceptProcessor
Returns a new instance of AcceptProcessor.
128 129 130 131 132 133 |
# File 'lib/right_speed/processor.rb', line 128 def initialize(workers, handler) @worker_num = workers @handler = handler @workers = workers.times.map{|i| Worker::Accepter.new(id: i, handler: @handler) } @closer = ConnectionCloser.new end |
Instance Method Details
#configure(listener:) ⇒ Object
135 136 137 |
# File 'lib/right_speed/processor.rb', line 135 def configure(listener:) @listener = listener end |
#run ⇒ Object
139 140 141 142 143 |
# File 'lib/right_speed/processor.rb', line 139 def run @listener.run @workers.each{|w| w.run(@listener.sock)} @closer.run(@workers.map{|w| w.ractor}) end |
#wait ⇒ Object
145 146 147 148 |
# File 'lib/right_speed/processor.rb', line 145 def wait # workers are using those outgoing to pass connections @closer.wait end |