From: Amos Jeffries Date: Tue, 20 Jul 2010 14:30:00 +0000 (+1200) Subject: Fallout from more auditing X-Git-Tag: take08~55^2~124^2~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d779c44367d2d8adf3376163d7bbd542a7af3de;p=thirdparty%2Fsquid.git Fallout from more auditing --- diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index 6f743b2247..4cfce774f1 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -180,12 +180,12 @@ void Adaptation::Icap::Xaction::closeConnection() debugs(93,3, HERE << "closing pconn" << status()); // comm_close will clear timeout connection->close(); - connection = NULL; } writer = NULL; reader = NULL; connector = NULL; + connection = NULL; } } diff --git a/src/comm/ConnOpener.cc b/src/comm/ConnOpener.cc index 180fe88f6c..94a33eddee 100644 --- a/src/comm/ConnOpener.cc +++ b/src/comm/ConnOpener.cc @@ -148,11 +148,17 @@ void Comm::ConnOpener::start() } } - tryConnecting(); + typedef CommCbMemFunT Dialer; + calls_.connect_ = asyncCall(5, 4, "Comm::ConnOpener::connect", + Dialer(this, &Comm::ConnOpener::connect)); + ScheduleCallHere(calls_.connect_); } +/** Make an FD connection attempt. + * Handles the case(s) when a partially setup connection gets closed early. + */ void -Comm::ConnOpener::tryConnecting() +Comm::ConnOpener::connect(const CommConnectCbParams &unused) { Must(conn_ != NULL); @@ -215,7 +221,7 @@ Comm::ConnOpener::tryConnecting() debugs(5, 5, HERE << "FD " << conn_->fd << ": * - ERR took too long already."); doneConnecting(COMM_TIMEOUT, errno); } else if (failRetries_ < Config.connect_retries) { - tryConnecting(); + ScheduleCallHere(calls_.connect_); } else { // send ERROR back to the upper layer. debugs(5, 5, HERE << "FD " << conn_->fd << ": * - ERR tried too many times already."); @@ -234,15 +240,6 @@ Comm::ConnOpener::earlyAbort(const CommConnectCbParams &io) doneConnecting(COMM_ERR_CLOSING, io.xerrno); // NP: is closing or shutdown better? } -/** Make an FD connection attempt. - * Handles the case(s) when a partially setup connection gets closed early. - */ -void -Comm::ConnOpener::connect(const CommConnectCbParams &unused) -{ - tryConnecting(); -} - /** * Handles the case(s) when a partially setup connection gets timed out. * NP: When commSetTimeout accepts generic CommCommonCbParams this can die. @@ -250,7 +247,7 @@ Comm::ConnOpener::connect(const CommConnectCbParams &unused) void Comm::ConnOpener::timeout(const CommTimeoutCbParams &unused) { - tryConnecting(); + ScheduleCallHere(calls_.connect_); } /* Legacy Wrapper for the retry event after COMM_INPROGRESS @@ -260,10 +257,11 @@ void Comm::ConnOpener::ConnectRetry(int fd, void *data) { ConnOpener *cs = static_cast(data); - cs->tryConnecting(); - // see if its done and delete Comm::ConnOpener? comm Writes are not yet a Job call. - // so the automatic cleanup on call completion does not seem to happen - if (cs->doneAll()); - cs->deleteThis("Done after Comm::ConnOpener::ConnectRetry()"); + // Ew. we are now outside the all AsyncJob protections. + // get back inside by scheduling another call... + typedef CommCbMemFunT Dialer; + AsyncCall::Pointer call = asyncCall(5, 4, "Comm::ConnOpener::connect", + Dialer(cs, &Comm::ConnOpener::connect)); + ScheduleCallHere(call); } diff --git a/src/comm/ConnOpener.h b/src/comm/ConnOpener.h index ad3d232250..ec5aa3abae 100644 --- a/src/comm/ConnOpener.h +++ b/src/comm/ConnOpener.h @@ -61,6 +61,7 @@ private: /// handles to calls which we may need to cancel. struct Calls { + AsyncCall::Pointer connect_; AsyncCall::Pointer earlyAbort_; AsyncCall::Pointer timeout_; } calls_;