]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1491: clientLifetime exceeded + external acl = assertion failure: !asyncInProgre...
authorserassio <>
Sun, 2 Apr 2006 17:58:38 +0000 (17:58 +0000)
committerserassio <>
Sun, 2 Apr 2006 17:58:38 +0000 (17:58 +0000)
This patch allow an ACLList destroy itself after check is complete.

If there is asyncInProgress() when the request is being destroyed, then let acl
checklist destroy it self once the check is done.

Patch provided by Gonzalo Arana.

src/ACLChecklist.cc
src/ACLChecklist.h
src/client_side_request.cc

index 940c41ecbce0f1e56a5adb8207319a1ad347c08e..6eeb87512ae10f064e89e2cd25665785d6e6ade9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLChecklist.cc,v 1.31 2006/02/18 00:23:43 wessels Exp $
+ * $Id: ACLChecklist.cc,v 1.32 2006/04/02 11:58:38 serassio Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -180,6 +180,12 @@ ACLChecklist::asyncInProgress(bool const newAsync)
     debug (28,3)("ACLChecklist::asyncInProgress: %p async set to %d\n", this, async_);
 }
 
+void
+ACLChecklist::markDeleteWhenDone()
+{
+    deleteWhenDone = true;
+}
+
 bool
 ACLChecklist::finished() const
 {
@@ -261,7 +267,12 @@ ACLChecklist::matchAclList(const acl_list * head, bool const fast)
         if (!nodeMatched || state_ != NullState::Instance()) {
             debug(28, 3) ("aclmatchAclList: %p returning false (AND list entry failed to match)\n", this);
             checkForAsync();
+
+            if (deleteWhenDone && !asyncInProgress())
+                delete this;
+
             PROF_stop(aclMatchAclList);
+
             return;
         }
 
@@ -303,6 +314,7 @@ ACLChecklist::ACLChecklist() : accessList (NULL), my_port (0), request (NULL),
         conn_(NULL),
         async_(false),
         finished_(false),
+        deleteWhenDone(false),
         allow_(ACCESS_DENIED),
         state_(NullState::Instance()),
         destinationDomainChecked_(false),
index 7583fdbfb408bed5851c331ec049071740dbc7e3..0e4d4c470481e74e9657e9918c80ccec2fd4c1dc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACLChecklist.h,v 1.21 2005/04/30 19:32:01 serassio Exp $
+ * $Id: ACLChecklist.h,v 1.22 2006/04/02 11:58:38 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -104,6 +104,7 @@ class NullState : public AsyncState
 
     bool asyncInProgress() const;
     void asyncInProgress(bool const);
+    void markDeleteWhenDone();
     bool finished() const;
     void markFinished();
     void check();
@@ -146,6 +147,7 @@ private:
     ConnStateData::Pointer conn_;      /* hack for ident and NTLM */
     bool async_;
     bool finished_;
+    bool deleteWhenDone;
     allow_t allow_;
     AsyncState *state_;
     bool destinationDomainChecked_;
index 472e42e508634afcfbea48acab353409ab6b5fd8..9464f5ba31ba209daa6ac4193a70ca3f2a8b4e26 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_request.cc,v 1.59 2006/03/02 22:47:07 wessels Exp $
+ * $Id: client_side_request.cc,v 1.60 2006/04/02 11:58:38 serassio Exp $
  * 
  * DEBUG: section 85    Client-side Request Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -110,8 +110,13 @@ ClientRequestContext::~ClientRequestContext()
     if (http)
         cbdataReferenceDone(http);
 
-    if (acl_checklist)
-        delete acl_checklist;
+    if (acl_checklist) {
+        if (acl_checklist->asyncInProgress()) {
+            acl_checklist->markDeleteWhenDone();
+        } else {
+            delete acl_checklist;
+        }
+    }
 }
 
 ClientRequestContext::ClientRequestContext(ClientHttpRequest *anHttp) : http(anHttp), acl_checklist (NULL), redirect_state (REDIRECT_NONE)