From 729c2889c5ce1163ae768690c2c8b5290b799338 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Wed, 31 Jan 2007 17:28:18 +0100 Subject: [PATCH] Make the receiver worker actually handle the socket. --- jam.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/jam.c b/jam.c index d22ced4..b4f8ad3 100644 --- a/jam.c +++ b/jam.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -7,7 +8,25 @@ void *receiver_worker(void *arg) { int sock = (int)arg; + char buf[65536]; + printf("Received worker for socket %u\n", sock); + + for ( ;; ) { + int ret = read(sock, buf, 65536); + if (ret == 0) + break; + + // FIXME: update stats here + } + + printf("Socket %u done\n", sock); + + if (close(sock) == -1) { + perror("close()"); + exit(1); + } + pthread_exit(0); } -- 2.39.2