From: sgunderson@bigfoot.com <> Date: Wed, 31 Jan 2007 16:28:18 +0000 (+0100) Subject: Make the receiver worker actually handle the socket. X-Git-Url: https://git.sesse.net/?p=jam;a=commitdiff_plain;h=729c2889c5ce1163ae768690c2c8b5290b799338 Make the receiver worker actually handle the socket. --- 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); }