From a044933f3eca3572c082c8f99e0c20d32e6d1ac2 Mon Sep 17 00:00:00 2001 From: Test_User Date: Tue, 15 Aug 2023 21:59:30 -0400 Subject: PING when timing out from server connection, consider it disconnected if still no reply --- main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3