if (!srv->stats.pending && !srv->stats.timedout) {
/* someone spoke without being spoken to */
- debugs(84, DBG_IMPORTANT, "ERROR: helperHandleRead: unexpected read from " <<
+ debugs(84, DBG_IMPORTANT, "ERROR: Killing helper process after an unexpected read from " <<
hlp->id_name << " #" << srv->index << ", " << (int)len <<
" bytes '" << srv->rbuf << "'");
srv->roffset = 0;
srv->rbuf[0] = '\0';
+ srv->closePipesSafely(hlp->id_name);
+ return;
}
bool needsMore = false;
srv->roffset += len;
srv->rbuf[srv->roffset] = '\0';
- Helper::Xaction *r = srv->requests.front();
debugs(84, DBG_DATA, Raw("accumulated", srv->rbuf, srv->roffset));
- if (r == nullptr) {
+ if (srv->requests.empty()) {
/* someone spoke without being spoken to */
- debugs(84, DBG_IMPORTANT, "ERROR: helperStatefulHandleRead: unexpected read from " <<
+ debugs(84, DBG_IMPORTANT, "ERROR: Killing helper process after an unexpected read from " <<
hlp->id_name << " #" << srv->index << ", " << (int)len <<
" bytes '" << srv->rbuf << "'");
srv->roffset = 0;
+ srv->closePipesSafely(hlp->id_name);
+ return;
}
if ((t = strchr(srv->rbuf, hlp->eom))) {
*t = '\0';
}
- if (r && !r->reply.accumulate(srv->rbuf, t ? (t - srv->rbuf) : srv->roffset)) {
+ const auto r = srv->requests.front();
+
+ if (!r->reply.accumulate(srv->rbuf, t ? (t - srv->rbuf) : srv->roffset)) {
debugs(84, DBG_IMPORTANT, "ERROR: Disconnecting from a " <<
"helper that overflowed " << srv->rbuf_sz << "-byte " <<
"Squid input buffer: " << hlp->id_name << " #" << srv->index);
srv->requests.pop_front(); // we already have it in 'r'
int called = 1;
- if (r && cbdataReferenceValid(r->request.data)) {
+ if (cbdataReferenceValid(r->request.data)) {
r->reply.finalize();
r->reply.reservationId = srv->reservationId;
r->request.callback(r->request.data, r->reply);