commEof(false),
reuseConnection(true),
isRetriable(true),
+ ignoreLastWrite(false),
connector(NULL), reader(NULL), writer(NULL), closer(NULL)
{
debugs(93,3, typeName << " constructed, this=" << this <<
}
void ICAPXaction::disableRetries() {
- debugs(93,5, typeName << (isRetriable ? "becomes" : "remains") <<
+ debugs(93,5, typeName << (isRetriable ? " becomes" : " remains") <<
" final" << status());
isRetriable = false;
}
debugs(93,3, typeName << " opens connection to " << s.host.buf() << ":" << s.port);
- commSetTimeout(connection, Config.Timeout.connect,
+ // TODO: service bypass status may differ from that of a transaction
+ commSetTimeout(connection, TheICAPConfig.connect_timeout(service().bypass),
&ICAPXaction_noteCommTimedout, this);
closer = &ICAPXaction_noteCommClosed;
Must(writer);
writer = NULL;
-
- Must(commStatus == COMM_OK);
-
- updateTimeout();
-
- handleCommWrote(size);
+
+ if (ignoreLastWrite) {
+ // a hack due to comm inability to cancel a pending write
+ ignoreLastWrite = false;
+ debugs(93, 7, HERE << "ignoring last write; status: " << commStatus);
+ } else {
+ Must(commStatus == COMM_OK);
+ updateTimeout();
+ handleCommWrote(size);
+ }
ICAPXaction_Exit();
}
void ICAPXaction::handleCommTimedout()
{
- debugs(93, 0, HERE << "ICAP FD " << connection << " timeout to " << theService->methodStr() << " " << theService->uri.buf());
+ debugs(93, 2, HERE << typeName << " timeout with " <<
+ theService->methodStr() << " " << theService->uri.buf() << status());
reuseConnection = false;
- MemBuf mb;
- mb.init();
-
- if (fillVirginHttpHeader(mb)) {
- debugs(93, 0, HERE << "\tfor " << mb.content());
- }
+ service().noteFailure();
- mustStop("connection with ICAP service timed out");
+ throw TexcHere(connector ?
+ "timed out while connecting to the ICAP service" :
+ "timed out while talking to the ICAP service");
}
// unexpected connection close while talking to the ICAP service
if (reader || writer) {
// restart the timeout before each I/O
// XXX: why does Config.Timeout lacks a write timeout?
- commSetTimeout(connection, Config.Timeout.read,
+ // TODO: service bypass status may differ from that of a transaction
+ commSetTimeout(connection, TheICAPConfig.io_timeout(service().bypass),
&ICAPXaction_noteCommTimedout, this);
} else {
// clear timeout when there is no I/O
/*
- * $Id: ICAPXaction.h,v 1.11 2007/05/08 16:32:12 rousskov Exp $
+ * $Id: ICAPXaction.h,v 1.12 2007/06/19 21:08:33 rousskov Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
bool commEof;
bool reuseConnection;
bool isRetriable;
+ bool ignoreLastWrite;
const char *stopReason;
IOCB *writer;
PF *closer;
- const char *typeName; // the type of the final class (child), for debugging
-
private:
static int TheLastId;
- const char *inCall; // name of the asynchronous call being executed, if any
-
static void reusedConnection(void *data);
//CBDATA_CLASS2(ICAPXaction);