diff options
Diffstat (limited to 'src/client.c')
-rw-r--r-- | src/client.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client.c b/src/client.c index 0dabbbf..3bf3649 100644 --- a/src/client.c +++ b/src/client.c @@ -9,6 +9,7 @@ #include "ser.h" #include "net.h" #include "ticker.h" +#include "sig.h" typedef struct { peer conn; @@ -59,6 +60,8 @@ bool handle_pkt(client *c, str pkt) int main() { + signal_setup(); + client c = {0}; c.name = str_clone(S("kitten")); @@ -94,11 +97,14 @@ int main() if (poll(fds, 2, ticker_timeout(&t)) < 0) { switch (errno) { - case EINTR: continue; + case EINTR: break; default: perror("poll"); continue; } } + if (signal_stop) + client_exit(&c, EXIT_SUCCESS); + if (fds[0].revents) { // this is cursed // maybe dont do this idk |