summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2023-08-15 21:59:30 -0400
committerTest_User <hax@andrewyu.org>2023-08-15 21:59:30 -0400
commita044933f3eca3572c082c8f99e0c20d32e6d1ac2 (patch)
tree4c1dabf48a3e625cc837fd98893e0be64b2d16fd
parent1ee39296f8ae3d09a0dd42faf92e28e35dba9d3a (diff)
downloadcoupserv-a044933f3eca3572c082c8f99e0c20d32e6d1ac2.tar.gz
coupserv-a044933f3eca3572c082c8f99e0c20d32e6d1ac2.zip
PING when timing out from server connection, consider it disconnected if still no reply
-rw-r--r--main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/main.c b/main.c
index f1a51bd..d57b0fe 100644
--- a/main.c
+++ b/main.c
@@ -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) {