]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed static requestLink() and requestUnlink() methods. Replaced them
authorwessels <>
Sat, 18 Feb 2006 01:10:59 +0000 (01:10 +0000)
committerwessels <>
Sat, 18 Feb 2006 01:10:59 +0000 (01:10 +0000)
with HTTPMSGLOCK() and HTTPMSGUNLOCK() macros.

34 files changed:
src/ACLChecklist.cc
src/ClientBody.cc
src/DelayId.cc
src/HttpMsg.cc
src/HttpMsg.h
src/HttpReply.h
src/HttpRequest.cc
src/HttpRequest.h
src/ICAP/ICAPConfig.cc
src/ICAP/MsgPipeData.h
src/MemObject.cc
src/Server.cc
src/access_log.cc
src/asn.cc
src/cache_manager.cc
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/errorpage.cc
src/forward.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/icp_v2.cc
src/internal.cc
src/mime.cc
src/neighbors.cc
src/net_db.cc
src/peer_digest.cc
src/peer_select.cc
src/store_digest.cc
src/tunnel.cc
src/urn.cc
src/wais.cc

index c177f17445a2ae010c36a3e8a485706972c73dad..6554058c166f8fff493207030a6f6e066874e98c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLChecklist.cc,v 1.29 2005/12/08 20:08:46 wessels Exp $
+ * $Id: ACLChecklist.cc,v 1.30 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -323,10 +323,7 @@ ACLChecklist::~ACLChecklist()
     if (extacl_entry)
         cbdataReferenceDone(extacl_entry);
 
-    if (request)
-        requestUnlink(request);
-
-    request = NULL;
+    HTTPMSGUNLOCK(request);
 
     conn_ = NULL;
 
@@ -496,7 +493,7 @@ aclChecklistCreate(const acl_access * A, HttpRequest * request, const char *iden
         checklist->accessList = cbdataReference(A);
 
     if (request != NULL) {
-        checklist->request = requestLink(request);
+        checklist->request = HTTPMSGLOCK(request);
         checklist->src_addr = request->client_addr;
         checklist->my_addr = request->my_addr;
         checklist->my_port = request->my_port;
index 6f61da6e13822f9a93794d5ceca0114afaf29b80..15c359a4ea0e03fc3a83c90d34e1725cb4728920 100644 (file)
@@ -6,7 +6,7 @@
 
 ClientBody::ClientBody(ConnStateData::Pointer & aConn, HttpRequest *Request) : conn(aConn), request(NULL), buf (NULL), bufsize(0), callback(NULL), cbdata(NULL)
 {
-    request = requestLink(Request);
+    request = HTTPMSGLOCK(Request);
 }
 
 ClientBody::~ClientBody()
@@ -14,7 +14,7 @@ ClientBody::~ClientBody()
     if (cbdata)
         cbdataReferenceDone(cbdata);
 
-    requestUnlink(request);
+    HTTPMSGUNLOCK(request);
 
     conn = NULL;       // refcounted
 }
index 2ed9457abe5d6bf482d888192e8baa8c49366f35..a6684fe7562bb0505754216c5662e1c846c7ba34 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: DelayId.cc,v 1.18 2005/12/08 20:08:46 wessels Exp $
+ * $Id: DelayId.cc,v 1.19 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 77    Delay Pools
  * AUTHOR: Robert Collins <robertc@squid-cache.org>
@@ -112,7 +112,7 @@ DelayId::DelayClient(ClientHttpRequest * http)
         if (http->getConn().getRaw() != NULL)
             ch.conn(http->getConn());
 
-        ch.request = requestLink(r);
+        ch.request = HTTPMSGLOCK(r);
 
         ch.accessList = cbdataReference(DelayPools::delay_data[pool].access);
 
index 920e4ba5869b00cc3beee246aba5543c2fa963a7..a547c7869fe709b5f845127e617fbc34e8aa0d81 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpMsg.cc,v 1.24 2006/01/23 20:04:24 wessels Exp $
+ * $Id: HttpMsg.cc,v 1.25 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 74    HTTP Message
  * AUTHOR: Alex Rousskov
@@ -362,14 +362,16 @@ void HttpMsg::firstLineBuf(MemBuf& mb)
 
 HttpMsg *
 
-HttpMsg::lock()
+// use HTTPMSGLOCK() instead of calling this directly
+HttpMsg::_lock()
 {
     lock_count++;
     return this;
 }
 
+// use HTTPMSGUNLOCK() instead of calling this directly
 void
-HttpMsg::unlock()
+HttpMsg::_unlock()
 {
     assert(lock_count > 0);
     --lock_count;
index 853953ad767a24b48ef4c9ad2b2662d60f5fe00e..d098743d20aad586e526571f1a583edc1833322a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpMsg.h,v 1.7 2006/01/23 20:04:24 wessels Exp $
+ * $Id: HttpMsg.h,v 1.8 2006/02/17 18:10:59 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -51,10 +51,8 @@ public:
 
     void packInto(Packer * p, bool full_uri) const;
 
-    virtual HttpMsg *lock()
-
-    ;
-    virtual void unlock();
+    virtual HttpMsg *_lock();  // please use HTTPMSGLOCK()
+    virtual void _unlock();    // please use HTTPMSGUNLOCK()
 
 public:
     HttpVersion http_ver;
@@ -105,4 +103,7 @@ protected:
 
 SQUIDCEXTERN int httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const char **blk_end);
 
+#define HTTPMSGUNLOCK(a) if(a){(a)->_unlock();(a)=NULL;}
+#define HTTPMSGLOCK(a) (a)->_lock()
+
 #endif /* SQUID_HTTPMSG_H */
index 041c2f39023f4b6d1bc08e32487e8dd6595ad828..790df613cf04db4f57cc19c4719e6772c690aa0a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpReply.h,v 1.15 2006/01/23 20:04:24 wessels Exp $
+ * $Id: HttpReply.h,v 1.16 2006/02/17 18:10:59 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -55,14 +55,11 @@ public:
 
     virtual void reset();
 
-    virtual HttpReply *lock()
-
+    // use HTTPMSGLOCK() instead of calling this directly
+    virtual HttpReply *_lock()
     {
-
-        return static_cast<HttpReply*>(HttpMsg::lock())
-
-                   ;
-    } ;
+        return static_cast<HttpReply*>(HttpMsg::_lock());
+    };
 
     //virtual void unlock();  // only needed for debugging
 
index be794e9a65ca88e10883a281e22013f1d6925b1f..53e28a6903ef8155598102420e44581cfd992604 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpRequest.cc,v 1.59 2006/01/23 20:04:24 wessels Exp $
+ * $Id: HttpRequest.cc,v 1.60 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 73    HTTP Request
  * AUTHOR: Duane Wessels
@@ -204,25 +204,6 @@ bool HttpRequest::parseFirstLine(const char *start, const char *end)
     return true;
 }
 
-HttpRequest *
-requestLink(HttpRequest * request)
-{
-    assert(request);
-
-    return request->lock()
-
-           ;
-}
-
-void
-requestUnlink(HttpRequest * request)
-{
-    if (!request)
-        return;
-
-    request->unlock();
-}
-
 int
 HttpRequest::parseHeader(const char *parse_start)
 {
index 53f0f11ec3fdc9e11ba0da62c82f88d02f45daab..48aeb95a4d8e2f605ec2f14a53b4cc93b6b0f4fb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpRequest.h,v 1.18 2006/01/23 20:04:24 wessels Exp $
+ * $Id: HttpRequest.h,v 1.19 2006/02/17 18:10:59 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -39,8 +39,6 @@
 #include "HierarchyLogEntry.h"
 
 /*  Http Request */
-extern HttpRequest *requestLink(HttpRequest *);
-extern void requestUnlink(HttpRequest *);
 extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConnection);
 extern int httpRequestHdrAllowedByName(http_hdr_type id);
 extern void httpRequestPack(void *obj, Packer *p);
@@ -58,13 +56,10 @@ public:
     ~HttpRequest();
     virtual void reset();
 
-    virtual HttpRequest *lock()
-
+    // use HTTPMSGLOCK() instead of calling this directly
+    virtual HttpRequest *_lock()
     {
-
-        return static_cast<HttpRequest*>(HttpMsg::lock())
-
-                   ;
+        return static_cast<HttpRequest*>(HttpMsg::_lock());
     };
 
     void initHTTP(method_t aMethod, protocol_t aProtocol, const char *aUrlpath);
index 61cf6ee322d9fc7e31cc1d1fda768b41f8a4e83f..8fca537a438d08494c3426644b0e82aa137ff62e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ICAPConfig.cc,v 1.5 2006/01/23 21:36:07 wessels Exp $
+ * $Id: ICAPConfig.cc,v 1.6 2006/02/17 18:11:00 wessels Exp $
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
@@ -115,11 +115,8 @@ ICAPAccessCheck::ICAPAccessCheck(ICAP::Method aMethod,
     method = aMethod;
     point = aPoint;
 
-    req = aReq->lock()
-
-          ;
-    rep = aRep ? aRep->lock()
-          : NULL;
+    req = HTTPMSGLOCK(aReq);
+    rep = aRep ? HTTPMSGLOCK(aRep) : NULL;
 
     callback = aCallback;
 
@@ -138,11 +135,8 @@ ICAPAccessCheck::ICAPAccessCheck(ICAP::Method aMethod,
 
 ICAPAccessCheck::~ICAPAccessCheck()
 {
-    if (req)
-        req->unlock();
-
-    if (rep)
-        rep->unlock();
+    HTTPMSGUNLOCK(req);
+    HTTPMSGUNLOCK(rep);
 }
 
 /*
index 06fd23539cdcdfb7c0a1b261aa41905c42cc5052..bc6e2bb06fdf1a7f868dab10e552793f5bd0e8f4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: MsgPipeData.h,v 1.6 2006/01/23 21:36:07 wessels Exp $
+ * $Id: MsgPipeData.h,v 1.7 2006/02/17 18:11:00 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -54,8 +54,8 @@ public:
 
     ~MsgPipeData()
     {
-        clearCause();
-        clearHeader();
+        HTTPMSGUNLOCK(cause);
+        HTTPMSGUNLOCK(header);
 
         if (body) {
             body->clean();
@@ -65,20 +65,14 @@ public:
 
     void setCause(HttpRequest *r)
     {
-        clearCause();
-
-        cause = r->lock()
-
-                ;
+        HTTPMSGUNLOCK(cause);
+        cause = HTTPMSGLOCK(r);
     };
 
     void setHeader(HttpMsg *msg)
     {
-        clearHeader();
-
-        header = msg->lock()
-
-                 ;
+        HTTPMSGUNLOCK(header);
+        header = HTTPMSGLOCK(msg);
     };
 
 public:
@@ -92,11 +86,6 @@ public:
     // HTTP request header for piped responses (the cause of the response)
     HttpRequest *cause;
 
-private:
-
-    void clearCause() { if (cause) { cause->unlock(); cause = NULL; } };
-
-    void clearHeader() { if (header) { header->unlock(); header = NULL; } };
 };
 
 #endif /* SQUID_MSGPIPEDATA_H */
index d7d460d06bb65a5701d111d38b3332dcb9a98d82..36e74c86468cdbb9972edcd0e6a0263c7b8327c1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: MemObject.cc,v 1.21 2006/01/23 20:04:24 wessels Exp $
+ * $Id: MemObject.cc,v 1.22 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 19    Store Memory Primitives
  * AUTHOR: Robert Collins
@@ -78,9 +78,7 @@ MemObject::MemObject(char const *aUrl, char const *aLog_url)
     debugs(20, 3, HERE << "new MemObject " << this);
     HttpReply *rep = new HttpReply;
 
-    _reply  = rep->lock()
-
-              ;
+    _reply  = HTTPMSGLOCK(rep);
     url = xstrdup(aUrl);
 
 #if URL_CHECKSUM_DEBUG
@@ -119,11 +117,9 @@ MemObject::~MemObject()
 
 #endif
 
-    _reply->unlock();
-
-    requestUnlink(request);
+    HTTPMSGUNLOCK(_reply);
 
-    request = NULL;
+    HTTPMSGUNLOCK(request);
 
     ctx_exit(ctx);              /* must exit before we free mem->url */
 
@@ -137,9 +133,7 @@ MemObject::~MemObject()
 void
 MemObject::unlinkRequest()
 {
-    /* XXX Should we assert(request)? */
-    requestUnlink(request);
-    request = NULL;
+    HTTPMSGUNLOCK(request);
 }
 
 void
@@ -198,12 +192,8 @@ MemObject::getReply() const
 void
 MemObject::replaceHttpReply(HttpReply *newrep)
 {
-    if (_reply)
-        _reply->unlock();
-
-    _reply = newrep->lock()
-
-             ;
+    HTTPMSGUNLOCK(_reply);
+    _reply = HTTPMSGLOCK(newrep);
 }
 
 struct LowestMemReader : public unary_function<store_client, void>
index 96c037018e740c168d8d3c4cd2f90e95b22d137b..b055066b83a2a94f749cdd8dc47f57320a8eb96a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: Server.cc,v 1.2 2006/01/25 19:26:14 wessels Exp $
+ * $Id: Server.cc,v 1.3 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG:
  * AUTHOR: Duane Wessels
@@ -46,18 +46,15 @@ ServerStateData::ServerStateData(FwdState *theFwdState)
     fwd = theFwdState;
     entry = fwd->entry;
     storeLockObject(entry);
-    request = requestLink(fwd->request);
+    request = HTTPMSGLOCK(fwd->request);
 }
 
 ServerStateData::~ServerStateData()
 {
     storeUnlockObject(entry);
 
-    if (request)
-        request->unlock();
-
-    if (reply)
-        reply->unlock();
+    HTTPMSGUNLOCK(request);
+    HTTPMSGUNLOCK(reply);
 
     fwd = NULL; // refcounted
 
index defee03e70aef1c85f768fc042e44d8e48b6d5f6..cbee3165d9b08f14ed156b77aa4fc61c18410daa 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: access_log.cc,v 1.107 2005/11/05 00:08:32 wessels Exp $
+ * $Id: access_log.cc,v 1.108 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -1791,10 +1791,7 @@ accessLogFreeMemory(AccessLogEntry * aLogEntry)
         aLogEntry->reply = NULL;
     }
 
-    if (aLogEntry->request) {
-        requestUnlink(aLogEntry->request);
-        aLogEntry->request = NULL;
-    }
+    HTTPMSGUNLOCK(aLogEntry->request);
 }
 
 int
index 3c748bcd6f6445309506d37732ea7001da49acf1..f2b64f4f32221ed3726225a3497a42156612402c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: asn.cc,v 1.102 2006/01/03 17:22:30 wessels Exp $
+ * $Id: asn.cc,v 1.103 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 53    AS Number handling
  * AUTHOR: Duane Wessels, Kostas Anagnostakis
@@ -236,7 +236,7 @@ asnCacheStart(int as)
     asState->as_number = as;
     req = urlParse(METHOD_GET, asres);
     assert(NULL != req);
-    asState->request = requestLink(req);
+    asState->request = HTTPMSGLOCK(req);
 
     if ((e = storeGetPublic(asres, METHOD_GET)) == NULL) {
         e = storeCreateEntry(asres, asres, request_flags(), METHOD_GET);
@@ -375,7 +375,7 @@ asStateFree(void *data)
     debug(53, 3) ("asnStateFree: %s\n", storeUrl(asState->entry));
     storeUnregister(asState->sc, asState->entry, asState);
     storeUnlockObject(asState->entry);
-    requestUnlink(asState->request);
+    HTTPMSGUNLOCK(asState->request);
     cbdataFree(asState);
 }
 
index dc45a9d9f50ba98910466983128323ffe9d32d40..285cb391a07f39955c82a7270779f9abb59c5dff 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_manager.cc,v 1.35 2006/01/23 20:04:24 wessels Exp $
+ * $Id: cache_manager.cc,v 1.36 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 16    Cache Manager Objects
  * AUTHOR: Duane Wessels
@@ -251,7 +251,7 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
     if ((mgr = cachemgrParseUrl(storeUrl(entry))) == NULL) {
         err = errorCon(ERR_INVALID_URL, HTTP_NOT_FOUND);
         err->url = xstrdup(storeUrl(entry));
-        err->request = requestLink(request);
+        err->request = HTTPMSGLOCK(request);
         errorAppendEntry(entry, err);
         entry->expires = squid_curtime;
         return;
@@ -282,7 +282,7 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
                           mgr->user_name ? mgr->user_name : "<unknown>",
                           fd_table[fd].ipaddr, mgr->action);
 
-        err->request = requestLink(request);
+        err->request = HTTPMSGLOCK(request);
 
         rep = errorBuildReply(err);
 
index ba1fc6f1042113ffde7347ed2b4648f445003492..ae1a85217103fd58fd7e3d5dd520702dff9b92f5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.709 2006/01/19 22:15:18 wessels Exp $
+ * $Id: client_side.cc,v 1.710 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -516,7 +516,7 @@ ClientHttpRequest::logRequest()
         checklist->reply = al.reply;
 
         if (!Config.accessList.log || checklist->fastCheck()) {
-            al.request = requestLink(request);
+            al.request = HTTPMSGLOCK(request);
             accessLogLog(&al, checklist);
             updateCounters();
 
@@ -537,8 +537,7 @@ ClientHttpRequest::freeResources()
     safe_free(log_uri);
     safe_free(redirect.location);
     range_iter.boundary.clean();
-    requestUnlink(request);
-    request = NULL;
+    HTTPMSGUNLOCK(request);
 
     if (client_stream.tail)
         clientStreamAbort((clientStreamNode *)client_stream.tail->data, this);
@@ -2294,7 +2293,7 @@ clientProcessRequest(ConnStateData::Pointer &conn, ClientSocketContext *context,
         return;
     }
 
-    http->request = requestLink(request);
+    http->request = HTTPMSGLOCK(request);
     clientSetKeepaliveFlag(http);
     /* Do we expect a request-body? */
 
index ec262633831b369616b7de4ea4440ff5950c3911..3873d54459e5b6180861dcdf380f607c8cd05f79 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_reply.cc,v 1.94 2006/01/23 20:04:24 wessels Exp $
+ * $Id: client_side_reply.cc,v 1.95 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 88    Client-side Reply Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -423,7 +423,7 @@ clientReplyContext::handleIMSGiveClientUpdatedOldEntry()
         int unlink_request = 0;
 
         if (old_entry->mem_obj->request == NULL) {
-            old_entry->mem_obj->request = requestLink(http->memObject()->request);
+            old_entry->mem_obj->request = HTTPMSGLOCK(http->memObject()->request);
             unlink_request = 1;
         }
 
@@ -439,10 +439,7 @@ clientReplyContext::handleIMSGiveClientUpdatedOldEntry()
 
         old_entry->timestamp = squid_curtime;
 
-        if (unlink_request) {
-            requestUnlink(old_entry->mem_obj->request);
-            old_entry->mem_obj->request = NULL;
-        }
+        HTTPMSGUNLOCK(old_entry->mem_obj->request);
     }
 
     sendClientOldEntry();
@@ -2158,7 +2155,7 @@ clientReplyContext::createStoreEntry(method_t m, request_flags flags)
      */
 
     if (http->request == NULL)
-        http->request = requestLink(new HttpRequest(m, PROTO_NONE, null_string));
+        http->request = HTTPMSGLOCK(new HttpRequest(m, PROTO_NONE, null_string));
 
     StoreEntry *e = storeCreateEntry(http->uri, http->log_uri, flags, m);
 
@@ -2204,7 +2201,7 @@ clientBuildError(err_type page_id, http_status status, char const *url,
         err->url = xstrdup(url);
 
     if (request)
-        err->request = requestLink(request);
+        err->request = HTTPMSGLOCK(request);
 
     return err;
 }
index e78be146762d11c482c4665573165c003d3e3ca2..934dcd8eadf94e2843e9c3f101a31c2659d09df6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_request.cc,v 1.56 2006/01/11 21:05:50 wessels Exp $
+ * $Id: client_side_request.cc,v 1.57 2006/02/17 18:10:59 wessels Exp $
  * 
  * DEBUG: section 85    Client-side Request Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -340,7 +340,7 @@ clientBeginRequest(method_t method, char const *url, CSCB * streamcallback,
 
     request->http_ver = http_ver;
 
-    http->request = requestLink(request);
+    http->request = HTTPMSGLOCK(request);
 
     /* optional - skip the access check ? */
     http->calloutContext = new ClientRequestContext(http);
@@ -870,8 +870,8 @@ ClientRequestContext::clientRedirectDone(char *result)
         new_request->extacl_user = old_request->extacl_user;
         new_request->extacl_passwd = old_request->extacl_passwd;
         new_request->flags.proxy_keepalive = old_request->flags.proxy_keepalive;
-        requestUnlink(old_request);
-        http->request = requestLink(new_request);
+        HTTPMSGUNLOCK(old_request);
+        http->request = HTTPMSGLOCK(new_request);
     }
 
     /* FIXME PIPELINE: This is innacurate during pipelining */
@@ -1141,8 +1141,8 @@ ClientHttpRequest::takeAdaptedHeaders(HttpMsg *msg)
          */
         new_req->body_connection = request->body_connection;
         request->body_connection = NULL;
-        requestUnlink(request);
-        request = requestLink(new_req);
+        HTTPMSGUNLOCK(request);
+        request = HTTPMSGLOCK(new_req);
         /*
          * Store the new URI for logging
          */
index d219cd8d9b224954fcd57538590fcac4993d8b15..a9e96e825ebeb65e98c95b7ec5ecb44e46c97362 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.206 2006/01/23 20:04:24 wessels Exp $
+ * $Id: errorpage.cc,v 1.207 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -460,7 +460,7 @@ errorSendComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag, voi
 void
 errorStateFree(ErrorState * err)
 {
-    requestUnlink(err->request);
+    HTTPMSGUNLOCK(err->request);
     safe_free(err->redirect_url);
     safe_free(err->url);
     safe_free(err->host);
index 09bc6d6eabe6836bc196b76d6d8bdff537627cdc..8078f42ecf32d88c06f6fc1c218a67552cd6a8bd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.135 2006/01/09 20:44:36 wessels Exp $
+ * $Id: forward.cc,v 1.136 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -75,7 +75,7 @@ FwdState::FwdState(int fd, StoreEntry * e, HttpRequest * r)
     entry = e;
     client_fd = fd;
     server_fd = -1;
-    request = requestLink(r);
+    request = HTTPMSGLOCK(r);
     start_t = squid_curtime;
     storeLockObject(e);
     EBIT_SET(e->flags, ENTRY_FWD_HDR_WAIT);
@@ -111,9 +111,7 @@ FwdState::~FwdState()
 
     serversFree(&servers);
 
-    requestUnlink(request);
-
-    request = NULL;
+    HTTPMSGUNLOCK(request);
 
     if (err)
         errorStateFree(err);
@@ -156,7 +154,7 @@ FwdState::fwdStart(int client_fd, StoreEntry *entry, HttpRequest *request)
         ch.src_addr = request->client_addr;
         ch.my_addr = request->my_addr;
         ch.my_port = request->my_port;
-        ch.request = requestLink(request);
+        ch.request = HTTPMSGLOCK(request);
         ch.accessList = cbdataReference(Config.accessList.miss);
         /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */
         int answer = ch.fastCheck();
@@ -170,7 +168,7 @@ FwdState::fwdStart(int client_fd, StoreEntry *entry, HttpRequest *request)
 
             ErrorState *anErr = errorCon(page_id, HTTP_FORBIDDEN);
 
-            anErr->request = requestLink(request);
+            anErr->request = HTTPMSGLOCK(request);
 
             anErr->src_addr = request->client_addr;
 
@@ -185,7 +183,7 @@ FwdState::fwdStart(int client_fd, StoreEntry *entry, HttpRequest *request)
      * This seems like an odd place to bind mem_obj and request.
      * Might want to assert that request is NULL at this point
      */
-    entry->mem_obj->request = requestLink(request);
+    entry->mem_obj->request = HTTPMSGLOCK(request);
 #if URL_CHECKSUM_DEBUG
 
     entry->mem_obj->checkUrlChecksum();
@@ -194,7 +192,7 @@ FwdState::fwdStart(int client_fd, StoreEntry *entry, HttpRequest *request)
     if (shutting_down) {
         /* more yuck */
         ErrorState *anErr = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE);
-        anErr->request = requestLink(request);
+        anErr->request = HTTPMSGLOCK(request);
         errorAppendEntry(entry, anErr);        // frees anErr
         return;
     }
@@ -236,7 +234,7 @@ FwdState::fail(ErrorState * errorState)
     err = errorState;
 
     if (!errorState->request)
-        errorState->request = requestLink(request);
+        errorState->request = HTTPMSGLOCK(request);
 }
 
 /*
@@ -458,7 +456,7 @@ FwdState::serverClosed(int fd)
 
     if (!err && shutting_down) {
         ErrorState *anErr = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE);
-        anErr->request = requestLink(request);
+        anErr->request = HTTPMSGLOCK(request);
     }
 
     self = NULL;       // refcounted
@@ -504,7 +502,7 @@ FwdState::negotiateSSL(int fd)
                 anErr->port = request->port;
             }
 
-            anErr->request = requestLink(request);
+            anErr->request = HTTPMSGLOCK(request);
             fail(anErr);
 
             if (fs->_peer) {
@@ -550,7 +548,7 @@ FwdState::initiateSSL()
                       ERR_error_string(ERR_get_error(), NULL));
         ErrorState *anErr = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
         anErr->xerrno = errno;
-        anErr->request = requestLink(request);
+        anErr->request = HTTPMSGLOCK(request);
         fail(anErr);
         self = NULL;           // refcounted
         return;
@@ -1123,7 +1121,7 @@ struct IN_ADDR
         ch.src_addr = request->client_addr;
         ch.my_addr = request->my_addr;
         ch.my_port = request->my_port;
-        ch.request = requestLink(request);
+        ch.request = HTTPMSGLOCK(request);
     }
 
     return aclMapAddr(Config.accessList.outgoing_address, &ch);
@@ -1138,7 +1136,7 @@ getOutgoingTOS(HttpRequest * request)
         ch.src_addr = request->client_addr;
         ch.my_addr = request->my_addr;
         ch.my_port = request->my_port;
-        ch.request = requestLink(request);
+        ch.request = HTTPMSGLOCK(request);
     }
 
     return aclMapTOS(Config.accessList.outgoing_tos, &ch);
index adfb533faba8faa034ee7f2eb9dc95dd37d2162b..6c6a7741e4702fbefc51ee0a8313949782c565ac 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.383 2006/01/26 00:22:18 wessels Exp $
+ * $Id: ftp.cc,v 1.384 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -3062,7 +3062,7 @@ ftpSendReply(FtpStateData * ftpState)
     }
 
     err = errorCon(err_code, http_code);
-    err->request = requestLink(ftpState->request);
+    err->request = HTTPMSGLOCK(ftpState->request);
 
     if (ftpState->old_request)
         err->ftp.request = xstrdup(ftpState->old_request);
@@ -3092,9 +3092,7 @@ FtpStateData::appendSuccessHeader()
     StoreEntry *e = entry;
     HttpReply *newrep = new HttpReply;
 
-    reply = newrep->lock()
-
-            ;
+    reply = HTTPMSGLOCK(newrep);
 
     if (flags.http_header_sent)
         return;
@@ -3189,7 +3187,7 @@ HttpReply *
 FtpStateData::ftpAuthRequired(HttpRequest * request, const char *realm)
 {
     ErrorState *err = errorCon(ERR_CACHE_ACCESS_DENIED, HTTP_UNAUTHORIZED);
-    err->request = requestLink(request);
+    err->request = HTTPMSGLOCK(request);
     HttpReply *newrep = errorBuildReply(err);
     errorStateFree(err);
     /* add Authenticate header */
@@ -3320,7 +3318,7 @@ FtpStateData::icapAclCheckDone(ICAPServiceRep::Pointer service)
          */
         ErrorState *err = errorCon(ERR_ICAP_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
         err->xerrno = errno;
-        err->request = requestLink(request);
+        err->request = HTTPMSGLOCK(request);
         errorAppendEntry(entry, err);
         comm_close(ctrl.fd);
         return;
@@ -3353,11 +3351,9 @@ FtpStateData::takeAdaptedHeaders(HttpReply *rep)
 
     assert (rep);
     storeEntryReplaceObject(entry, rep);
-    reply->unlock();
+    HTTPMSGUNLOCK(reply);
 
-    reply = rep->lock()
-
-            ;
+    reply = HTTPMSGLOCK(rep);
 
     debug(11,5)("FtpStateData::takeAdaptedHeaders() finished\n");
 }
@@ -3417,7 +3413,7 @@ FtpStateData::abortAdapting()
     if (entry->isEmpty()) {
         ErrorState *err;
         err = errorCon(ERR_ICAP_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
-        err->request = requestLink((HttpRequest *) request);
+        err->request = HTTPMSGLOCK((HttpRequest *) request);
         err->xerrno = errno;
         fwd->fail(err);
         fwd->dontRetry(true);
index f8ba607bb41d1c36a77ee25e9f176c75a1a183aa..50f4fd28f0c1ce6c214d6eb80d96ca228fa2d1b9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.192 2006/01/03 17:22:31 wessels Exp $
+ * $Id: gopher.cc,v 1.193 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -129,9 +129,7 @@ gopherStateFree(int fdnotused, void *data)
         storeUnlockObject(gopherState->entry);
     }
 
-    if (gopherState->req) {
-        requestUnlink(gopherState->req);
-    }
+    HTTPMSGUNLOCK(gopherState->req);
 
     gopherState->fwd = NULL;   // refcounted
 
index 7a72b2a5f0d66067da05437e06727ac428ba07b0..1eac276475bb55dccb9f3fd7df5ea301a3bf79f3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.485 2006/02/08 00:16:23 wessels Exp $
+ * $Id: http.cc,v 1.486 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -82,7 +82,7 @@ HttpStateData::HttpStateData(FwdState *theFwdState) : ServerStateData(theFwdStat
     fd = fwd->server_fd;
     readBuf = new MemBuf;
     readBuf->init(4096, SQUID_TCP_SO_RCVBUF);
-    orig_request = requestLink(fwd->request);
+    orig_request = HTTPMSGLOCK(fwd->request);
 
     if (fwd->servers)
         _peer = fwd->servers->_peer;         /* might be NULL */
@@ -108,9 +108,9 @@ HttpStateData::HttpStateData(FwdState *theFwdState) : ServerStateData(theFwdStat
 
         proxy_req->flags.proxying = 1;
 
-        requestUnlink(request);
+        HTTPMSGUNLOCK(request);
 
-        request = requestLink(proxy_req);
+        request = HTTPMSGLOCK(proxy_req);
 
         /*
          * This NEIGHBOR_PROXY_ONLY check probably shouldn't be here.
@@ -156,9 +156,7 @@ HttpStateData::~HttpStateData()
 
     delete readBuf;
 
-    requestUnlink(orig_request);
-
-    orig_request = NULL;
+    HTTPMSGUNLOCK(orig_request);
 
     debugs(11,5,HERE << "HttpStateData " << this << " destroyed");
 }
@@ -775,9 +773,7 @@ HttpStateData::processReplyHeader()
         return;
     }
 
-    reply = newrep->lock()
-
-            ;
+    reply = HTTPMSGLOCK(newrep);
 
     debug(11, 9) ("GOT HTTP REPLY HDR:\n---------\n%s\n----------\n",
                   readBuf->content());
@@ -1870,7 +1866,7 @@ HttpStateData::sendRequestEntityDone(int fd)
 {
     ACLChecklist ch;
     debug(11, 5) ("httpSendRequestEntityDone: FD %d\n", fd);
-    ch.request = requestLink(request);
+    ch.request = HTTPMSGLOCK(request);
 
     if (Config.accessList.brokenPosts)
         ch.accessList = cbdataReference(Config.accessList.brokenPosts);
@@ -2014,7 +2010,7 @@ HttpStateData::icapAclCheckDone(ICAPServiceRep::Pointer service)
          */
         ErrorState *err = errorCon(ERR_ICAP_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
         err->xerrno = errno;
-        err->request = requestLink(orig_request);
+        err->request = HTTPMSGLOCK(orig_request);
         errorAppendEntry(entry, err);
         comm_close(fd);
         return;
@@ -2047,11 +2043,9 @@ HttpStateData::takeAdaptedHeaders(HttpReply *rep)
 
     assert (rep);
     storeEntryReplaceObject(entry, rep);
-    reply->unlock();
-
-    reply = rep->lock()
+    HTTPMSGUNLOCK(reply);
 
-            ;
+    reply = HTTPMSGLOCK(rep);
 
     haveParsedReplyHeaders();
 
@@ -2115,7 +2109,7 @@ HttpStateData::abortAdapting()
     if (entry->isEmpty()) {
         ErrorState *err;
         err = errorCon(ERR_ICAP_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
-        err->request = requestLink((HttpRequest *) request);
+        err->request = HTTPMSGLOCK((HttpRequest *) request);
         err->xerrno = errno;
         fwd->fail( err);
         fwd->dontRetry(true);
index 4bc43652c2dd6ff2037d34239fcd72305247e6de..2e101624ac4cbdb0ae096d0aaeb7bdcb6f72b3e6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icp_v2.cc,v 1.89 2006/01/19 18:40:28 wessels Exp $
+ * $Id: icp_v2.cc,v 1.90 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 12    Internet Cache Protocol
  * AUTHOR: Duane Wessels
@@ -397,7 +397,7 @@ icpAccessAllowed(struct sockaddr_in *from, HttpRequest * icp_request)
     ACLChecklist checklist;
     checklist.src_addr = from->sin_addr;
     checklist.my_addr = no_addr;
-    checklist.request = requestLink(icp_request);
+    checklist.request = HTTPMSGLOCK(icp_request);
     checklist.accessList = cbdataReference(Config.accessList.icp);
     /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */
     int result = checklist.fastCheck();
@@ -447,12 +447,12 @@ doV2Query(int fd, struct sockaddr_in from, char *buf, icp_common_t header)
     if (!icp_request)
         return;
 
-    requestLink(icp_request);
+    HTTPMSGLOCK(icp_request);
 
     if (!icpAccessAllowed(&from, icp_request))
     {
         icpDenyAccess(&from, url, header.reqnum, fd);
-        requestUnlink(icp_request);
+        HTTPMSGUNLOCK(icp_request);
         return;
     }
 
@@ -483,7 +483,7 @@ doV2Query(int fd, struct sockaddr_in from, char *buf, icp_common_t header)
 
     StoreEntry::getPublic (state, url, METHOD_GET);
 
-    requestUnlink(icp_request);
+    HTTPMSGUNLOCK(icp_request);
 }
 
 void
index a61565ad49d119479dc7d9b0d1c879e3cffa32ba..5b20febacf2c8733293f0b6cd6357316c857bc28 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: internal.cc,v 1.35 2006/01/23 20:04:24 wessels Exp $
+ * $Id: internal.cc,v 1.36 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 76    Internal Squid Object handling
  * AUTHOR: Duane, Alex, Henrik
@@ -77,7 +77,7 @@ internalStart(HttpRequest * request, StoreEntry * entry)
         debugObj(76, 1, "internalStart: unknown request:\n",
                  request, (ObjPackMethod) & httpRequestPack);
         err = errorCon(ERR_INVALID_REQ, HTTP_NOT_FOUND);
-        err->request = requestLink(request);
+        err->request = HTTPMSGLOCK(request);
         errorAppendEntry(entry, err);
     }
 }
index bc37447688c8f6e8f3adef6a2b1edea62bf1d34b..6d811e1e57eea368bf16957f18ad9ecbcfd0a2e6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mime.cc,v 1.121 2006/01/23 20:04:24 wessels Exp $
+ * $Id: mime.cc,v 1.122 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 25    MIME Parsing
  * AUTHOR: Harvest Derived
@@ -605,7 +605,7 @@ MimeIcon::created (StoreEntry *newEntry)
     if (NULL == r)
         fatal("mimeLoadIcon: cannot parse internal URL");
 
-    e->mem_obj->request = requestLink(r);
+    e->mem_obj->request = HTTPMSGLOCK(r);
 
     HttpReply *reply = new HttpReply;
 
index c40bd44063811afb542d667c60d699513f1d915f..50e5f51140d95f3fd5b63020208cfecdce1bb0e8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.332 2005/12/08 20:08:47 wessels Exp $
+ * $Id: neighbors.cc,v 1.333 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -183,7 +183,7 @@ peerAllowedToUse(const peer * p, HttpRequest * request)
 
     checklist.my_port = request->my_port;
 
-    checklist.request = requestLink(request);
+    checklist.request = HTTPMSGLOCK(request);
 
     checklist.accessList = cbdataReference(p->access);
 
@@ -1479,14 +1479,15 @@ peerCountMcastPeersStart(void *data)
     p->mcast.flags.count_event_pending = 0;
     snprintf(url, MAX_URL, "http://%s/", inet_ntoa(p->in_addr.sin_addr));
     fake = storeCreateEntry(url, url, request_flags(), METHOD_GET);
+    HttpRequest *req = urlParse(METHOD_GET, url);
     psstate = new ps_state;
-    psstate->request = requestLink(urlParse(METHOD_GET, url));
+    psstate->request = HTTPMSGLOCK(req);
     psstate->entry = fake;
     psstate->callback = NULL;
     psstate->callback_data = p;
     psstate->ping.start = current_time;
     mem = fake->mem_obj;
-    mem->request = requestLink(psstate->request);
+    mem->request = HTTPMSGLOCK(psstate->request);
     mem->start_ping = current_time;
     mem->ping_reply_callback = peerCountHandleIcpReply;
     mem->ircb_data = psstate;
@@ -1526,11 +1527,10 @@ peerCountMcastPeersDone(void *data)
                   p->stats.rtt);
     p->mcast.n_replies_expected = (int) p->mcast.avg_n_members;
     EBIT_SET(fake->flags, ENTRY_ABORTED);
-    requestUnlink(fake->mem_obj->request);
-    fake->mem_obj->request = NULL;
+    HTTPMSGUNLOCK(fake->mem_obj->request);
     storeReleaseRequest(fake);
     storeUnlockObject(fake);
-    requestUnlink(psstate->request);
+    HTTPMSGUNLOCK(psstate->request);
     cbdataFree(psstate);
 }
 
index b633d19a37bd49883d6162b7bf0511e64612eee5..c744da05f0f3334042b8a7170db83df81ef79dca 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: net_db.cc,v 1.181 2006/01/23 20:04:24 wessels Exp $
+ * $Id: net_db.cc,v 1.182 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 38    Network Measurement Database
  * AUTHOR: Duane Wessels
@@ -866,7 +866,7 @@ netdbExchangeDone(void *data)
 {
     netdbExchangeState *ex = (netdbExchangeState *)data;
     debug(38, 3) ("netdbExchangeDone: %s\n", storeUrl(ex->e));
-    requestUnlink(ex->r);
+    HTTPMSGUNLOCK(ex->r);
     storeUnregister(ex->sc, ex->e, ex);
     storeUnlockObject(ex->e);
     cbdataReferenceDone(ex->p);
@@ -1302,7 +1302,7 @@ netdbExchangeStart(void *data)
         return;
     }
 
-    requestLink(ex->r);
+    HTTPMSGLOCK(ex->r);
     assert(NULL != ex->r);
     ex->r->http_ver = HttpVersion(1,0);
     ex->connstate = STATE_HEADER;
index a64c67b42de3b48c8277fe4aa589cbea04ae7d94..ab29ae9a48d334dfb15dca67a03ab4d3af773af2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_digest.cc,v 1.108 2006/01/19 22:10:55 wessels Exp $
+ * $Id: peer_digest.cc,v 1.109 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 72    Peer Digest Routines
  * AUTHOR: Alex Rousskov
@@ -337,7 +337,7 @@ peerDigestRequest(PeerDigest * pd)
 
     fetch = cbdataAlloc(DigestFetchState);
 
-    fetch->request = requestLink(req);
+    fetch->request = HTTPMSGLOCK(req);
 
     fetch->pd = cbdataReference(pd);
 
@@ -541,7 +541,7 @@ peerDigestFetchReply(void *data, char *buf, ssize_t size)
 
             if (!fetch->old_entry->mem_obj->request)
                 fetch->old_entry->mem_obj->request = r =
-                                                         requestLink(fetch->entry->mem_obj->request);
+                                                         HTTPMSGLOCK(fetch->entry->mem_obj->request);
 
             assert(fetch->old_entry->mem_obj->request);
 
@@ -922,12 +922,10 @@ peerDigestFetchFinish(DigestFetchState * fetch, int err)
 
     storeUnlockObject(fetch->entry);
 
-    requestUnlink(fetch->request);
+    HTTPMSGUNLOCK(fetch->request);
 
     fetch->entry = NULL;
 
-    fetch->request = NULL;
-
     assert(fetch->pd == NULL);
 
     cbdataFree(fetch);
index 4412bdcd1f0add6d587d07a08c61a0fb2d1f8ccb..d84345a97a6173b4815614ffcc8d821e0cdb615c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.137 2006/01/03 17:22:31 wessels Exp $
+ * $Id: peer_select.cc,v 1.138 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -110,8 +110,7 @@ peerSelectStateFree(ps_state * psstate)
         delete (psstate->acl_checklist);
     }
 
-    requestUnlink(psstate->request);
-    psstate->request = NULL;
+    HTTPMSGUNLOCK(psstate->request);
 
     if (psstate->entry) {
         assert(psstate->entry->ping_status != PING_WAITING);
@@ -161,7 +160,7 @@ peerSelect(HttpRequest * request,
 
     psstate = new ps_state;
 
-    psstate->request = requestLink(request);
+    psstate->request = HTTPMSGLOCK(request);
 
     psstate->entry = entry;
 
index f8ee6646f45c8340ac22a1190377fdaf0c526c01..eadd1e2950effb9d2e1494201aa4c7f6d9da7ac1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_digest.cc,v 1.61 2006/01/23 20:04:24 wessels Exp $
+ * $Id: store_digest.cc,v 1.62 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 71    Store Digest Manager
  * AUTHOR: Alex Rousskov
@@ -398,7 +398,8 @@ storeDigestRewriteStart(void *datanotused)
     sd_state.rewrite_lock = cbdataAlloc(generic_cbdata);
     sd_state.rewrite_lock->data = e;
     debug(71, 3) ("storeDigestRewrite: url: %s key: %s\n", url, e->getMD5Text());
-    e->mem_obj->request = requestLink(urlParse(METHOD_GET, url));
+    HttpRequest *req = urlParse(METHOD_GET, url);
+    e->mem_obj->request = HTTPMSGLOCK(req);
     /* wait for rebuild (if any) to finish */
 
     if (sd_state.rebuild_lock) {
index 92672e05ac63cb45d3050a934f85123af8fa44f1..4983b6ae656e4fc37c24daae705e7f612e634545 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tunnel.cc,v 1.158 2006/01/03 23:26:20 wessels Exp $
+ * $Id: tunnel.cc,v 1.159 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -158,8 +158,7 @@ sslStateFree(SslStateData * sslState)
     safe_free(sslState->url);
     FwdState::serversFree(&sslState->servers);
     sslState->host = NULL;
-    requestUnlink(sslState->request);
-    sslState->request = NULL;
+    HTTPMSGUNLOCK(sslState->request);
     delete sslState;
 }
 
@@ -466,7 +465,7 @@ sslConnectTimeout(int fd, void *data)
 
     err->port = sslState->port;
 
-    err->request = requestLink(request);
+    err->request = HTTPMSGLOCK(request);
 
     err->callback = sslErrorComplete;
 
@@ -549,7 +548,7 @@ sslConnectDone(int fdnotused, comm_err_t status, int xerrno, void *data)
         debug(26, 4) ("sslConnect: Unknown host: %s\n", sslState->host);
         err = errorCon(ERR_DNS_FAIL, HTTP_NOT_FOUND);
         *sslState->status_ptr = HTTP_NOT_FOUND;
-        err->request = requestLink(request);
+        err->request = HTTPMSGLOCK(request);
         err->dnsserver_msg = xstrdup(dns_error_message);
         err->callback = sslErrorComplete;
         err->callback_data = sslState;
@@ -560,7 +559,7 @@ sslConnectDone(int fdnotused, comm_err_t status, int xerrno, void *data)
         err->xerrno = xerrno;
         err->host = xstrdup(sslState->host);
         err->port = sslState->port;
-        err->request = requestLink(request);
+        err->request = HTTPMSGLOCK(request);
         err->callback = sslErrorComplete;
         err->callback_data = sslState;
         errorSend(sslState->client.fd(), err);
@@ -603,7 +602,7 @@ sslStart(ClientHttpRequest * http, size_t * size_ptr, int *status_ptr)
         ch.src_addr = request->client_addr;
         ch.my_addr = request->my_addr;
         ch.my_port = request->my_port;
-        ch.request = requestLink(request);
+        ch.request = HTTPMSGLOCK(request);
         ch.accessList = cbdataReference(Config.accessList.miss);
         /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */
         answer = ch.fastCheck();
@@ -611,7 +610,7 @@ sslStart(ClientHttpRequest * http, size_t * size_ptr, int *status_ptr)
         if (answer == 0) {
             err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN);
             *status_ptr = HTTP_FORBIDDEN;
-            err->request = requestLink(request);
+            err->request = HTTPMSGLOCK(request);
             err->src_addr = request->client_addr;
             errorSend(fd, err);
             return;
@@ -636,7 +635,7 @@ sslStart(ClientHttpRequest * http, size_t * size_ptr, int *status_ptr)
         err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
         *status_ptr = HTTP_INTERNAL_SERVER_ERROR;
         err->xerrno = errno;
-        err->request = requestLink(request);
+        err->request = HTTPMSGLOCK(request);
         errorSend(fd, err);
         return;
     }
@@ -648,7 +647,7 @@ sslStart(ClientHttpRequest * http, size_t * size_ptr, int *status_ptr)
 #endif
 
     sslState->url = xstrdup(url);
-    sslState->request = requestLink(request);
+    sslState->request = HTTPMSGLOCK(request);
     sslState->server.size_ptr = size_ptr;
     sslState->status_ptr = status_ptr;
     sslState->client.fd(fd);
@@ -721,7 +720,7 @@ sslPeerSelectComplete(FwdServer * fs, void *data)
         ErrorState *err;
         err = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE);
         *sslState->status_ptr = HTTP_SERVICE_UNAVAILABLE;
-        err->request = requestLink(sslState->request);
+        err->request = HTTPMSGLOCK(sslState->request);
         err->callback = sslErrorComplete;
         err->callback_data = sslState;
         errorSend(sslState->client.fd(), err);
index 0c3c8330b65ebff924d51f6cf1207f1943e15b85..ae695f1898a39b791458de2f5831e1db5ba3d4ce 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: urn.cc,v 1.94 2006/01/23 20:04:24 wessels Exp $
+ * $Id: urn.cc,v 1.95 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 52    URN Parsing
  * AUTHOR: Kostas Anagnostakis
@@ -228,13 +228,13 @@ UrnState::setUriResFromRequest(HttpRequest *r)
         debug(52, 3) ("urnStart: Bad uri-res URL %s\n", urlres);
         ErrorState *err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND);
         err->url = urlres;
-        err->request = requestLink(r);
+        err->request = HTTPMSGLOCK(r);
         urlres = NULL;
         errorAppendEntry(entry, err);
         return;
     }
 
-    requestLink(urlres_r);
+    HTTPMSGLOCK(urlres_r);
     httpHeaderPutStr(&urlres_r->header, HDR_ACCEPT, "text/plain");
 }
 
@@ -243,7 +243,7 @@ UrnState::start(HttpRequest * r, StoreEntry * e)
 {
     debug(52, 3) ("urnStart: '%s'\n", storeUrl(e));
     entry = e;
-    request = requestLink(r);
+    request = HTTPMSGLOCK(r);
     storeLockObject(entry);
     setUriResFromRequest(r);
 
@@ -375,7 +375,7 @@ urnHandleReply(void *data, StoreIOBuffer result)
     if (rep->sline.status != HTTP_OK) {
         debug(52, 3) ("urnHandleReply: failed.\n");
         err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND);
-        err->request = requestLink(urnState->request);
+        err->request = HTTPMSGLOCK(urnState->request);
         err->url = xstrdup(storeUrl(e));
         errorAppendEntry(e, err);
         delete rep;
@@ -397,7 +397,7 @@ urnHandleReply(void *data, StoreIOBuffer result)
     if (urls == NULL) {                /* unkown URN error */
         debug(52, 3) ("urnTranslateDone: unknown URN %s\n", storeUrl(e));
         err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND);
-        err->request = requestLink(urnState->request);
+        err->request = HTTPMSGLOCK(urnState->request);
         err->url = xstrdup(storeUrl(e));
         errorAppendEntry(e, err);
         goto error;
@@ -463,8 +463,8 @@ urnHandleReply(void *data, StoreIOBuffer result)
 error:
     storeUnlockObject(urlres_e);
     storeUnlockObject(urnState->entry);
-    requestUnlink(urnState->request);
-    requestUnlink(urnState->urlres_r);
+    HTTPMSGUNLOCK(urnState->request);
+    HTTPMSGUNLOCK(urnState->urlres_r);
     delete urnState;
 }
 
index cef0dfcb96f59ead447afa6be999ea9d8e3f8d90..871c9fc4490766909d6354bd86c69f56e5cdd38d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.155 2006/01/03 17:22:31 wessels Exp $
+ * $Id: wais.cc,v 1.156 2006/02/17 18:10:59 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -75,7 +75,7 @@ waisStateFree(int fdnotused, void *data)
 
     storeUnlockObject(waisState->entry);
 
-    requestUnlink(waisState->request);
+    HTTPMSGUNLOCK(waisState->request);
 
     waisState->fwd = NULL;     // refcounted
 
@@ -262,7 +262,7 @@ waisStart(FwdState * fwd)
     waisState->entry = entry;
     waisState->dataWritten = 0;
     xstrncpy(waisState->url, url, MAX_URL);
-    waisState->request = requestLink(request);
+    waisState->request = HTTPMSGLOCK(request);
     waisState->fwd = fwd;
     comm_add_close_handler(waisState->fd, waisStateFree, waisState);
     storeLockObject(entry);