Obsolete
/
ipc.cr-old
Archived
3
0
Fork 0

pongc now exits correctly.

dev
Karchnu 2020-07-20 22:05:25 +02:00
parent 725b23e4e5
commit c7c0909f35
1 changed files with 7 additions and 1 deletions

View File

@ -58,6 +58,8 @@ def main
exit 1
end
nb_messages_remaining = CLI.rounds
# Listening on STDIN.
client << 0
@ -87,7 +89,11 @@ def main
client.send message
end
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
info "Disconnection from #{event.fd}"
if event.fd == 0