Browse code

fix to bb1891 patch(edge of buffer problem)

Steve Morgan authored on 2012/12/27 05:04:28
Showing 1 changed files
... ...
@@ -665,7 +665,9 @@ static int handle_stream(client_conn_t *conn, struct fd_buf *buf, const struct o
665 665
 		logg("$Quota Remaining: %lu\n", buf->quota);
666 666
 	    } else {
667 667
 		/* need more data, so return and wait for some */
668
-                *ppos = pos;
668
+		memmove (buf->buffer, &buf->buffer[pos], buf->off - pos);
669
+		buf->off -= pos;
670
+		*ppos = 0;
669 671
                 return -1;
670 672
             }
671 673
 	}
... ...
@@ -679,7 +681,7 @@ static int handle_stream(client_conn_t *conn, struct fd_buf *buf, const struct o
679 679
 	    logg("!INSTREAM: Can't write to temporary file.\n");
680 680
 	    *error = 1;
681 681
 	}
682
-	logg("$Processed %lu bytes of chunkdata\n", cmdlen);
682
+	logg("$Processed %lu bytes of chunkdata, pos %lu\n", cmdlen, pos);
683 683
 	pos += cmdlen;
684 684
 	if (pos == buf->off) {
685 685
 	    buf->off = 0;