summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/main.c b/main.c
index 0fdd429..6d29836 100644
--- a/main.c
+++ b/main.c
@@ -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"));