From: wessels <> Date: Sat, 18 Feb 2006 01:10:59 +0000 (+0000) Subject: Removed static requestLink() and requestUnlink() methods. Replaced them X-Git-Tag: SQUID_3_0_PRE4~332 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6dd9f4bd1614a35e4bdb25cd7365cdc7761171d7;p=thirdparty%2Fsquid.git Removed static requestLink() and requestUnlink() methods. Replaced them with HTTPMSGLOCK() and HTTPMSGUNLOCK() macros. --- diff --git a/src/ACLChecklist.cc b/src/ACLChecklist.cc index c177f17445..6554058c16 100644 --- a/src/ACLChecklist.cc +++ b/src/ACLChecklist.cc @@ -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; diff --git a/src/ClientBody.cc b/src/ClientBody.cc index 6f61da6e13..15c359a4ea 100644 --- a/src/ClientBody.cc +++ b/src/ClientBody.cc @@ -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 } diff --git a/src/DelayId.cc b/src/DelayId.cc index 2ed9457abe..a6684fe756 100644 --- a/src/DelayId.cc +++ b/src/DelayId.cc @@ -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 @@ -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); diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index 920e4ba586..a547c7869f 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -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; diff --git a/src/HttpMsg.h b/src/HttpMsg.h index 853953ad76..d098743d20 100644 --- a/src/HttpMsg.h +++ b/src/HttpMsg.h @@ -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 */ diff --git a/src/HttpReply.h b/src/HttpReply.h index 041c2f3902..790df613cf 100644 --- a/src/HttpReply.h +++ b/src/HttpReply.h @@ -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(HttpMsg::lock()) - - ; - } ; + return static_cast(HttpMsg::_lock()); + }; //virtual void unlock(); // only needed for debugging diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index be794e9a65..53e28a6903 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -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) { diff --git a/src/HttpRequest.h b/src/HttpRequest.h index 53f0f11ec3..48aeb95a4d 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -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(HttpMsg::lock()) - - ; + return static_cast(HttpMsg::_lock()); }; void initHTTP(method_t aMethod, protocol_t aProtocol, const char *aUrlpath); diff --git a/src/ICAP/ICAPConfig.cc b/src/ICAP/ICAPConfig.cc index 61cf6ee322..8fca537a43 100644 --- a/src/ICAP/ICAPConfig.cc +++ b/src/ICAP/ICAPConfig.cc @@ -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); } /* diff --git a/src/ICAP/MsgPipeData.h b/src/ICAP/MsgPipeData.h index 06fd23539c..bc6e2bb06f 100644 --- a/src/ICAP/MsgPipeData.h +++ b/src/ICAP/MsgPipeData.h @@ -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 */ diff --git a/src/MemObject.cc b/src/MemObject.cc index d7d460d06b..36e74c8646 100644 --- a/src/MemObject.cc +++ b/src/MemObject.cc @@ -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 diff --git a/src/Server.cc b/src/Server.cc index 96c037018e..b055066b83 100644 --- a/src/Server.cc +++ b/src/Server.cc @@ -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 diff --git a/src/access_log.cc b/src/access_log.cc index defee03e70..cbee3165d9 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -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 diff --git a/src/asn.cc b/src/asn.cc index 3c748bcd6f..f2b64f4f32 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -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); } diff --git a/src/cache_manager.cc b/src/cache_manager.cc index dc45a9d9f5..285cb391a0 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -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 : "", fd_table[fd].ipaddr, mgr->action); - err->request = requestLink(request); + err->request = HTTPMSGLOCK(request); rep = errorBuildReply(err); diff --git a/src/client_side.cc b/src/client_side.cc index ba1fc6f104..ae1a852171 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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? */ diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index ec26263383..3873d54459 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -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; } diff --git a/src/client_side_request.cc b/src/client_side_request.cc index e78be14676..934dcd8ead 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -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 */ diff --git a/src/errorpage.cc b/src/errorpage.cc index d219cd8d9b..a9e96e825e 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -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); diff --git a/src/forward.cc b/src/forward.cc index 09bc6d6eab..8078f42ecf 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -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); diff --git a/src/ftp.cc b/src/ftp.cc index adfb533fab..6c6a7741e4 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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); diff --git a/src/gopher.cc b/src/gopher.cc index f8ba607bb4..50f4fd28f0 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -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 diff --git a/src/http.cc b/src/http.cc index 7a72b2a5f0..1eac276475 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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); diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 4bc43652c2..2e101624ac 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -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 diff --git a/src/internal.cc b/src/internal.cc index a61565ad49..5b20febacf 100644 --- a/src/internal.cc +++ b/src/internal.cc @@ -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); } } diff --git a/src/mime.cc b/src/mime.cc index bc37447688..6d811e1e57 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -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; diff --git a/src/neighbors.cc b/src/neighbors.cc index c40bd44063..50e5f51140 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -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); } diff --git a/src/net_db.cc b/src/net_db.cc index b633d19a37..c744da05f0 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -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; diff --git a/src/peer_digest.cc b/src/peer_digest.cc index a64c67b42d..ab29ae9a48 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -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); diff --git a/src/peer_select.cc b/src/peer_select.cc index 4412bdcd1f..d84345a97a 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -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; diff --git a/src/store_digest.cc b/src/store_digest.cc index f8ee6646f4..eadd1e2950 100644 --- a/src/store_digest.cc +++ b/src/store_digest.cc @@ -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) { diff --git a/src/tunnel.cc b/src/tunnel.cc index 92672e05ac..4983b6ae65 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -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); diff --git a/src/urn.cc b/src/urn.cc index 0c3c8330b6..ae695f1898 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -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; } diff --git a/src/wais.cc b/src/wais.cc index cef0dfcb96..871c9fc449 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -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);