Class: RightSpeed::Listener::RoundRobinListener
Instance Attribute Summary collapse
#sock
Instance Method Summary
collapse
#initialize
Instance Attribute Details
#ractor ⇒ Object
Returns the value of attribute ractor.
48
49
50
|
# File 'lib/right_speed/listener.rb', line 48
def ractor
@ractor
end
|
Instance Method Details
#run(processor) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/right_speed/listener.rb', line 50
def run(processor)
@running = true
@ractor = Ractor.new(@host, @port, @backlog, processor) do |host, port, backlog, processor|
logger = RightSpeed.logger
sock = TCPServer.open(host, port)
sock.listen(backlog) if backlog
logger.info { "listening #{host}:#{port}" }
while conn = sock.accept
processor.process(conn)
end
end
end
|
#stop ⇒ Object
67
68
69
70
|
# File 'lib/right_speed/listener.rb', line 67
def stop
@running = false
@ractor = nil end
|
#wait ⇒ Object
63
64
65
|
# File 'lib/right_speed/listener.rb', line 63
def wait
@ractor.take
end
|