=== modified file 'src/helper.cc' --- src/helper.cc 2012-11-24 14:30:02 +0000 +++ src/helper.cc 2012-12-04 14:17:59 +0000 @@ -866,42 +866,42 @@ -- srv->stats.pending; ++ srv->stats.replies; ++ hlp->stats.replies; srv->answer_time = current_time; srv->dispatch_time = r->dispatch_time; hlp->stats.avg_svc_time = Math::intAverage(hlp->stats.avg_svc_time, tvSubMsec(r->dispatch_time, current_time), hlp->stats.replies, REDIRECT_AV_FACTOR); helperRequestFree(r); } else { debugs(84, DBG_IMPORTANT, "helperHandleRead: unexpected reply on channel " << request_number << " from " << hlp->id_name << " #" << srv->index + 1 << " '" << srv->rbuf << "'"); } - srv->roffset -= (msg_end - srv->rbuf); - memmove(srv->rbuf, msg_end, srv->roffset + 1); + srv->roffset -= (msg_end - srv->rbuf + 1); + memmove(srv->rbuf, msg_end, srv->roffset); if (!srv->flags.shutdown) { helperKickQueue(hlp); } else if (!srv->flags.closing && !srv->stats.pending) { srv->flags.closing=1; srv->writePipe->close(); return; } } static void helperHandleRead(const Comm::ConnectionPointer &conn, char *buf, size_t len, comm_err_t flag, int xerrno, void *data) { char *t = NULL; helper_server *srv = (helper_server *)data; helper *hlp = srv->parent; assert(cbdataReferenceValid(data)); /* Bail out early on COMM_ERR_CLOSING - close handlers will tidy up for us */