}
void
-HelperServerBase::closePipesSafely()
+HelperServerBase::closePipesSafely(const char *id_name)
{
#if _SQUID_WINDOWS_
shutdown(writePipe->fd, SD_BOTH);
if (hIpc) {
if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) {
getCurrentTime();
- debugs(84, DBG_IMPORTANT, "WARNING: " << hlp->id_name <<
- " #" << index << " (" << hlp->cmdline->key << "," <<
- (long int)pid << ") didn't exit in 5 seconds");
+ debugs(84, DBG_IMPORTANT, "WARNING: " << id_name <<
+ " #" << index << " (PID " << (long int)pid << ") didn't exit in 5 seconds");
}
CloseHandle(hIpc);
}
}
void
-HelperServerBase::closeWritePipeSafely()
+HelperServerBase::closeWritePipeSafely(const char *id_name)
{
#if _SQUID_WINDOWS_
shutdown(writePipe->fd, (readPipe->fd == writePipe->fd ? SD_BOTH : SD_SEND));
if (hIpc) {
if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) {
getCurrentTime();
- debugs(84, DBG_IMPORTANT, "WARNING: " << hlp->id_name <<
- " #" << index << " (" << hlp->cmdline->key << "," <<
- (long int)pid << ") didn't exit in 5 seconds");
+ debugs(84, DBG_IMPORTANT, "WARNING: " << id_name <<
+ " #" << index << " (PID " << (long int)pid << ") didn't exit in 5 seconds");
}
CloseHandle(hIpc);
}
/* the rest of the details is dealt with in the helperServerFree
* close handler
*/
- srv->closePipesSafely();
+ srv->closePipesSafely(hlp->id_name);
}
}
/* the rest of the details is dealt with in the helperStatefulServerFree
* close handler
*/
- srv->closePipesSafely();
+ srv->closePipesSafely(hlp->id_name);
}
}
}
if (Comm::IsConnOpen(srv->writePipe))
- srv->closeWritePipeSafely();
+ srv->closeWritePipeSafely(hlp->id_name);
dlinkDelete(&srv->link, &hlp->servers);
/* TODO: walk the local queue of requests and carry them all out */
if (Comm::IsConnOpen(srv->writePipe))
- srv->closeWritePipeSafely();
+ srv->closeWritePipeSafely(hlp->id_name);
dlinkDelete(&srv->link, &hlp->servers);
debugs(84, 5, "helperHandleRead: " << len << " bytes from " << hlp->id_name << " #" << srv->index);
if (flag != Comm::OK || len == 0) {
- srv->closePipesSafely();
+ srv->closePipesSafely(hlp->id_name);
return;
}
debugs(84, DBG_IMPORTANT, "ERROR: Disconnecting from a " <<
"helper that overflowed " << srv->rbuf_sz << "-byte " <<
"Squid input buffer: " << hlp->id_name << " #" << srv->index);
- srv->closePipesSafely();
+ srv->closePipesSafely(hlp->id_name);
return;
}
hlp->id_name << " #" << srv->index);
if (flag != Comm::OK || len == 0) {
- srv->closePipesSafely();
+ srv->closePipesSafely(hlp->id_name);
return;
}
debugs(84, DBG_IMPORTANT, "ERROR: Disconnecting from a " <<
"helper that overflowed " << srv->rbuf_sz << "-byte " <<
"Squid input buffer: " << hlp->id_name << " #" << srv->index);
- srv->closePipesSafely();
+ srv->closePipesSafely(hlp->id_name);
return;
}
if (!srv->flags.shutdown) {
helperStatefulKickQueue(srv->parent);
} else if (!srv->flags.closing && !srv->flags.reserved && !srv->flags.busy) {
- srv->closeWritePipeSafely();
+ srv->closeWritePipeSafely(srv->parent->id_name);
return;
}
}
public:
/** Closes pipes to the helper safely.
* Handles the case where the read and write pipes are the same FD.
+ *
+ * \param name displayed for the helper being shutdown if logging an error
*/
- void closePipesSafely();
+ void closePipesSafely(const char *name);
/** Closes the reading pipe.
* If the read and write sockets are the same the write pipe will
* also be closed. Otherwise its left open for later handling.
+ *
+ * \param name displayed for the helper being shutdown if logging an error
*/
- void closeWritePipeSafely();
+ void closeWritePipeSafely(const char *name);
public:
/// Helper program identifier; does not change when contents do,