htparser: Fixed up duplex timeouts.
[ashd.git] / src / htparser.c
index bb23539..d10121c 100644 (file)
@@ -152,7 +152,7 @@ static off_t passdata(struct bufio *in, struct bufio *out, off_t max)
 
 static int recvchunks(struct bufio *in, struct bufio *out)
 {
-    size_t read, chlen;
+    ssize_t read, chlen;
     int c, r;
     
     while(1) {
@@ -333,7 +333,8 @@ static void passduplex(struct bufio *a, int afd, struct bufio *b, int bfd)
            if(ev)
                pfd[n++] = (struct selected){.fd = bfd, .ev = ev};
        }
-       sel = mblock(600, n, pfd);
+       if((sel = mblock(600, n, pfd)).ev == 0)
+           break;
        if(sel.fd == afd)
            sio = a;
        else if(sel.fd == bfd)