]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added some timeout debugging for ICAP transactions. Since ICAPXaction
authorwessels <>
Tue, 10 Jan 2006 03:38:44 +0000 (03:38 +0000)
committerwessels <>
Tue, 10 Jan 2006 03:38:44 +0000 (03:38 +0000)
doesn't know anything about its derived classes, also added a
HttpMsg::firstLineBuf() method to be used in the debugging of timeouts.

src/HttpMsg.cc
src/HttpMsg.h
src/ICAP/ICAPModXact.cc
src/ICAP/ICAPModXact.h
src/ICAP/ICAPXaction.cc
src/ICAP/ICAPXaction.h

index 53b9e005142abea973f1b2c3406c00efaa40fe7a..b9112b4a54884d1c45038f1afa37769178fedc75 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpMsg.cc,v 1.22 2005/12/29 18:04:41 wessels Exp $
+ * $Id: HttpMsg.cc,v 1.23 2006/01/09 20:38:44 wessels Exp $
  *
  * DEBUG: section 74    HTTP Message
  * AUTHOR: Alex Rousskov
@@ -343,3 +343,14 @@ void HttpMsg::hdrCacheInit()
     assert(NULL == cache_control);
     cache_control = httpHeaderGetCc(&header);
 }
+
+/*
+ * useful for debugging
+ */
+void HttpMsg::firstLineBuf(MemBuf& mb)
+{
+    Packer p;
+    packerToMemInit(&p, &mb);
+    packFirstLineInto(&p, true);
+    packerClean(&p);
+}
index 893c5deec22b43e6781039bbdb8a32e7784c4050..3fdd7a9d87ac954953d2a7b3f9a6c343e155d3e3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpMsg.h,v 1.5 2005/11/21 23:02:37 wessels Exp $
+ * $Id: HttpMsg.h,v 1.6 2006/01/09 20:38:44 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -81,6 +81,10 @@ protected:
     virtual void packFirstLineInto(Packer * p, bool full_uri) const = 0;
     virtual bool parseFirstLine(const char *blk_start, const char *blk_end) = 0;
     virtual void hdrCacheInit();
+
+public:
+
+    void firstLineBuf(MemBuf&);
 };
 
 
index 51189b7b34ff88f36521155f7ea3f2b5e243778f..87c6f5dc57e1c63a22c33c885bbfbd1ac8243bba 100644 (file)
@@ -1272,3 +1272,18 @@ void ICAPPreview::wrote(size_t size, bool sawEof)
             theState = stIeof;
 }
 
+bool ICAPModXact::fillVirginHttpHeader(MemBuf &mb) const
+{
+    if (virgin == NULL)
+        return false;
+
+    if (virgin->data == NULL)
+        return false;
+
+    if (virgin->data->header == NULL)
+        return false;
+
+    virgin->data->header->firstLineBuf(mb);
+
+    return true;
+}
index ad62c85f8e242cf9b5ea4c33b5c82b5b121e7012..6873883ad3b8a1c6f490500d2d5051ad34c9ecf0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ICAPModXact.h,v 1.4 2005/12/22 23:09:09 wessels Exp $
+ * $Id: ICAPModXact.h,v 1.5 2006/01/09 20:38:44 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -212,6 +212,7 @@ private:
 
     virtual void fillPendingStatus(MemBuf &buf) const;
     virtual void fillDoneStatus(MemBuf &buf) const;
+    virtual bool fillVirginHttpHeader(MemBuf&) const;
 
 private:
     void packHead(MemBuf &httpBuf, const HttpMsg *head);
index 826aa25b03e79e920e9b9d0650c2bda4d37f3c93..5161246db94e84385059c0f483d373eca9b7efaf 100644 (file)
@@ -179,6 +179,7 @@ void ICAPXaction::scheduleWrite(MemBuf &buf)
     writer = &ICAPXaction_noteCommWrote;
     comm_old_write_mbuf(connection, &buf, writer, this);
     fd_table[connection].noteUse(icapPconnPool);
+    commSetTimeout(connection, 61, &ICAPXaction_noteCommTimedout, this);
 }
 
 void ICAPXaction::noteCommWrote(comm_err_t commStatus, size_t size)
@@ -207,6 +208,14 @@ void ICAPXaction::noteCommTimedout()
 
 void ICAPXaction::handleCommTimedout()
 {
+    debugs(93, 0, HERE << "ICAP FD " << connection << " timeout to " << theService->methodStr() << " " << theService->uri.buf());
+    MemBuf mb;
+    mb.init();
+
+    if (fillVirginHttpHeader(mb)) {
+        debugs(93, 0, HERE << "\tfor " << mb.content());
+    }
+
     mustStop("connection with ICAP service timed out");
 }
 
@@ -252,6 +261,7 @@ void ICAPXaction::scheduleRead()
      */
 
     comm_read(connection, commBuf, readBuf.spaceSize(), reader, this);
+    commSetTimeout(connection, 61, &ICAPXaction_noteCommTimedout, this);
 }
 
 // comm module read a portion of the ICAP response for us
@@ -437,3 +447,8 @@ void ICAPXaction::fillDoneStatus(MemBuf &buf) const
     if (stopReason != NULL)
         buf.Printf("Stopped");
 }
+
+bool ICAPXaction::fillVirginHttpHeader(MemBuf &buf) const
+{
+    return false;
+}
index a4646662b1b1284ec176fefb011c5cf2cf1d8343..b43c5ab2b3773cfb04ad9946d1d28e97f82f9ae5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ICAPXaction.h,v 1.5 2005/12/22 23:40:26 wessels Exp $
+ * $Id: ICAPXaction.h,v 1.6 2006/01/09 20:38:44 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -97,6 +97,9 @@ protected:
     virtual void fillPendingStatus(MemBuf &buf) const;
     virtual void fillDoneStatus(MemBuf &buf) const;
 
+    // useful for debugging
+    virtual bool fillVirginHttpHeader(MemBuf&) const;
+
 protected:
     int connection;     // FD of the ICAP server connection