diff options
author | Test_User <hax@andrewyu.org> | 2023-08-15 21:59:30 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2023-08-15 21:59:30 -0400 |
commit | a044933f3eca3572c082c8f99e0c20d32e6d1ac2 (patch) | |
tree | 4c1dabf48a3e625cc837fd98893e0be64b2d16fd | |
parent | 1ee39296f8ae3d09a0dd42faf92e28e35dba9d3a (diff) | |
download | coupserv-a044933f3eca3572c082c8f99e0c20d32e6d1ac2.tar.gz coupserv-a044933f3eca3572c082c8f99e0c20d32e6d1ac2.zip |
PING when timing out from server connection, consider it disconnected if still no reply
Diffstat (limited to '')
-rw-r--r-- | main.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -253,6 +253,7 @@ int main(void) { char timeout; uint64_t new_len; + char last_timeout = 0; while (1) { pthread_mutex_unlock(&send_lock); new_len = RECV(data, sizeof(data), &timeout); @@ -260,7 +261,12 @@ int main(void) { if (!timeout) break; - SEND(STRING("")); + if (last_timeout) { + break; + } else { + SEND(STRING(":1HC PING 100 100\n")); // TODO: Fix this as well + last_timeout = 1; + } } if (new_len == 0) { |