diff options
Diffstat (limited to '')
-rw-r--r-- | main.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -230,9 +230,18 @@ int main(void) { struct string full_msg = {malloc(0), 0}; while (1) { char data[512]; - pthread_mutex_unlock(&send_lock); - uint64_t new_len = RECV(data, sizeof(data)); - pthread_mutex_lock(&send_lock); + + char timeout; + uint64_t new_len; + while (1) { + pthread_mutex_unlock(&send_lock); + new_len = RECV(data, sizeof(data), &timeout); + pthread_mutex_lock(&send_lock); + if (!timeout) + break; + + SEND(STRING("")); + } if (new_len == 0) { WRITES(1, STRING("Disconnected.\n")); |