print state
parent
d45d254d41
commit
f74898e2cf
|
@ -282,6 +282,7 @@ def main
|
|||
server = TCPServer.new(CLI.host, CLI.port_to_listen)
|
||||
service = IPC::Server.new CLI.service_name
|
||||
service << server.fd
|
||||
|
||||
# Every few seconds, the service should trigger the timer
|
||||
# Allowing the sending of Ping messages to clients
|
||||
service.base_timer = CLI.timer_delay
|
||||
|
@ -289,11 +290,12 @@ def main
|
|||
|
||||
service.loop do |event|
|
||||
# info "current state of the context:"
|
||||
# service.pp
|
||||
service.pp
|
||||
case event
|
||||
when IPC::Event::Timer
|
||||
info "#{CORANGE}IPC::Event::Timer#{CRESET}"
|
||||
sending_ping_messages
|
||||
|
||||
when IPC::Event::Connection
|
||||
info "#{CBLUE}IPC::Event::Connection#{CRESET}: #{event.fd}"
|
||||
when IPC::Event::Disconnection
|
||||
|
@ -301,16 +303,13 @@ def main
|
|||
Context.context.remove_fd event.fd
|
||||
when IPC::Event::ExtraSocket
|
||||
info "#{CBLUE}IPC::Event::ExtraSocket#{CRESET}: #{event.fd}"
|
||||
|
||||
if server.fd != event.fd
|
||||
raise "Error: the only extra socket should be the TCP/WS server"
|
||||
end
|
||||
|
||||
handle_new_clients(service, server)
|
||||
|
||||
when IPC::Event::Switch
|
||||
info "\033[36mIPC::Event::Switch#{CRESET}: from fd #{event.fd}"
|
||||
|
||||
# raise "Not implemented."
|
||||
|
||||
when IPC::Event::MessageSent
|
||||
|
|
Loading…
Reference in New Issue