pongc now exits correctly.
This commit is contained in:
parent
725b23e4e5
commit
c7c0909f35
@ -58,6 +58,8 @@ def main
|
|||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
nb_messages_remaining = CLI.rounds
|
||||||
|
|
||||||
# Listening on STDIN.
|
# Listening on STDIN.
|
||||||
client << 0
|
client << 0
|
||||||
|
|
||||||
@ -87,7 +89,11 @@ def main
|
|||||||
client.send message
|
client.send message
|
||||||
end
|
end
|
||||||
when IPC::Event::MessageReceived
|
when IPC::Event::MessageReceived
|
||||||
info "new message from #{event.fd}: #{event.message.to_s}"
|
nb_messages_remaining -= 1
|
||||||
|
info "new message from #{event.fd}: #{event.message.to_s}, remaining #{nb_messages_remaining}"
|
||||||
|
if nb_messages_remaining == 0
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
when IPC::Event::Disconnection
|
when IPC::Event::Disconnection
|
||||||
info "Disconnection from #{event.fd}"
|
info "Disconnection from #{event.fd}"
|
||||||
if event.fd == 0
|
if event.fd == 0
|
||||||
|
Reference in New Issue
Block a user