[prev in list] [next in list] [prev in thread] [next in thread]
List: squid-cvs
Subject: /bzr/squid3/trunk/ r12108: Bug 3505: crash in CbcPointer<Comm::ConnOpener> constructor
From: Amos Jeffries <squid3 () treenet ! co ! nz>
Date: 2012-04-03 11:06:14
Message-ID: 20120403111018.81878.qmail () squid-cache ! org
[Download RAW message or body]
--===============0015902945==
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------
revno: 12108
fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=3505
author: Alex Rousskov <rousskov@measurement-factory.com>
committer: Amos Jeffries <squid3@treenet.co.nz>
branch nick: trunk
timestamp: Tue 2012-04-03 23:06:14 +1200
message:
Bug 3505: crash in CbcPointer<Comm::ConnOpener> constructor
modified:
src/comm/ConnOpener.cc
src/comm/ConnOpener.h
--===============0015902945==
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; name="r12108.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
=== modified file 'src/comm/ConnOpener.cc'
--- a/src/comm/ConnOpener.cc 2012-03-07 22:54:00 +0000
+++ b/src/comm/ConnOpener.cc 2012-04-03 11:06:14 +0000
@@ -241,7 +241,7 @@
return;
} else {
debugs(5, 5, HERE << conn_ << ": COMM_INPROGRESS");
- Comm::SetSelect(temporaryFd_, COMM_SELECT_WRITE, \
Comm::ConnOpener::InProgressConnectRetry, this, 0); + \
Comm::SetSelect(temporaryFd_, COMM_SELECT_WRITE, \
Comm::ConnOpener::InProgressConnectRetry, new Pointer(this), 0); }
break;
@@ -261,7 +261,7 @@
doneConnecting(COMM_TIMEOUT, errno);
} else if (failRetries_ < Config.connect_retries) {
debugs(5, 5, HERE << conn_ << ": * - try again");
- eventAdd("Comm::ConnOpener::DelayedConnectRetry", \
Comm::ConnOpener::DelayedConnectRetry, this, 0.05, 0); + \
eventAdd("Comm::ConnOpener::DelayedConnectRetry", \
Comm::ConnOpener::DelayedConnectRetry, new Pointer(this), 0.05, 0); return;
} else {
// send ERROR back to the upper layer.
@@ -319,14 +319,16 @@
void
Comm::ConnOpener::InProgressConnectRetry(int fd, void *data)
{
- ConnOpener *cs = static_cast<Comm::ConnOpener *>(data);
- assert(cs);
-
+ Pointer *ptr = static_cast<Pointer*>(data);
+ assert(ptr);
+ if (ConnOpener *cs = ptr->valid()) {
// Ew. we are now outside the all AsyncJob protections.
// get back inside by scheduling another call...
typedef NullaryMemFunT<Comm::ConnOpener> Dialer;
AsyncCall::Pointer call = JobCallback(5, 4, Dialer, cs, \
Comm::ConnOpener::connect); ScheduleCallHere(call);
+ }
+ delete ptr;
}
/* Legacy Wrapper for the retry event with small delay after errors.
@@ -335,12 +337,14 @@
void
Comm::ConnOpener::DelayedConnectRetry(void *data)
{
- ConnOpener *cs = static_cast<Comm::ConnOpener *>(data);
- assert(cs);
-
+ Pointer *ptr = static_cast<Pointer*>(data);
+ assert(ptr);
+ if (ConnOpener *cs = ptr->valid()) {
// Ew. we are now outside the all AsyncJob protections.
// get back inside by scheduling another call...
typedef NullaryMemFunT<Comm::ConnOpener> Dialer;
AsyncCall::Pointer call = JobCallback(5, 4, Dialer, cs, \
Comm::ConnOpener::connect); ScheduleCallHere(call);
+ }
+ delete ptr;
}
=== modified file 'src/comm/ConnOpener.h'
--- a/src/comm/ConnOpener.h 2012-03-07 22:54:00 +0000
+++ b/src/comm/ConnOpener.h 2012-04-03 11:06:14 +0000
@@ -21,6 +21,8 @@
virtual void swanSong();
public:
+ typedef CbcPointer<ConnOpener> Pointer;
+
virtual bool doneAll() const;
ConnOpener(Comm::ConnectionPointer &, AsyncCall::Pointer &handler, time_t \
connect_timeout);
--===============0015902945==--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic