[prev in list] [next in list] [prev in thread] [next in thread]
List: squid-cvs
Subject: squid3-icap squid3/src/ICAP ICAPServiceRep.cc,1.1.2.9,1.1.2.10 ICAPServiceRep.h,1.1.2.7,1.1.2.8
From: Alex Rousskov <rousskov () users ! sourceforge ! net>
Date: 2006-10-30 18:18:50
Message-ID: 20061030181852.45521.qmail () squid-cache ! org
[Download RAW message or body]
Update of cvs.devel.squid-cache.org:/cvsroot/squid/squid3/src/ICAP
Modified Files:
Tag: squid3-icap
ICAPServiceRep.cc ICAPServiceRep.h
Log Message:
- Fixed and simplified up/down status reporting by remembering the last
reported status instead of making wrong guesses about it.
- Report the reason for the down status.
Index: ICAPServiceRep.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/ICAP/ICAPServiceRep.cc,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -C2 -d -r1.1.2.9 -r1.1.2.10
*** ICAPServiceRep.cc 26 Oct 2006 05:20:12 -0000 1.1.2.9
--- ICAPServiceRep.cc 30 Oct 2006 18:18:48 -0000 1.1.2.10
***************
*** 21,25 ****
theSessionFailures(0), isSuspended(0),
waiting(false), notifying(false),
! updateScheduled(false), self(NULL)
{}
--- 21,26 ----
theSessionFailures(0), isSuspended(0),
waiting(false), notifying(false),
! updateScheduled(false), self(NULL),
! wasAnnouncedUp(true) // do not announce an "up" service at startup
{}
***************
*** 165,174 ****
{
assert(self != NULL);
- const bool wasOk = up(); // ignore unprobed service invalidation
-
Pointer savedSelf = self; // to prevent destruction when we nullify self
self = NULL;
! announceStatusChange(wasOk, false);
savedSelf = NULL; // may destroy us and, hence, invalidate cbdata(this)
--- 166,173 ----
{
assert(self != NULL);
Pointer savedSelf = self; // to prevent destruction when we nullify self
self = NULL;
! announceStatusChange("invalidated by reconfigure", false);
savedSelf = NULL; // may destroy us and, hence, invalidate cbdata(this)
***************
*** 194,201 ****
debugs(93,4, "keeping ICAPService suspended, also for " << reason);
} else {
- const bool wasOk = !probed() || up();
isSuspended = reason;
! debugs(93,2, "suspending ICAPService for " << reason);
! announceStatusChange(wasOk, true);
}
}
--- 193,199 ----
debugs(93,4, "keeping ICAPService suspended, also for " << reason);
} else {
isSuspended = reason;
! debugs(93,1, "suspending ICAPService for " << reason);
! announceStatusChange("suspended", true);
}
}
***************
*** 339,344 ****
newOptions);
- const bool wasOk = !probed() || up();
-
delete theOptions;
theOptions = newOptions;
--- 337,340 ----
***************
*** 348,352 ****
checkOptions();
! announceStatusChange(wasOk, true);
}
--- 344,348 ----
checkOptions();
! announceStatusChange("down after an options fetch failure", true);
}
***************
*** 395,407 ****
}
! void ICAPServiceRep::announceStatusChange(bool wasOk, bool important) const
{
! if (wasOk == up()) // no significant changes to announce
return;
const char *what = bypass ? "optional" : "essential";
! const char *state = wasOk ? "down" : "up";
const int level = important ? 1 : 2;
debugs(93,level, what << " ICAP service is " << state << ": " << uri);
}
--- 391,405 ----
}
! void ICAPServiceRep::announceStatusChange(const char *downPhrase, bool important) const
{
! if (wasAnnouncedUp == up()) // no significant changes to announce
return;
const char *what = bypass ? "optional" : "essential";
! const char *state = wasAnnouncedUp ? downPhrase : "up";
const int level = important ? 1 : 2;
debugs(93,level, what << " ICAP service is " << state << ": " << uri);
+
+ wasAnnouncedUp = !wasAnnouncedUp;
}
Index: ICAPServiceRep.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/ICAP/ICAPServiceRep.h,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** ICAPServiceRep.h 25 Oct 2006 23:06:15 -0000 1.1.2.7
--- ICAPServiceRep.h 30 Oct 2006 18:18:48 -0000 1.1.2.8
***************
*** 157,165 ****
void checkOptions();
! void announceStatusChange(bool wasUp, bool important) const;
const char *status() const;
Pointer self;
CBDATA_CLASS2(ICAPServiceRep);
};
--- 157,166 ----
void checkOptions();
! void announceStatusChange(const char *downPhrase, bool important) const;
const char *status() const;
Pointer self;
+ mutable bool wasAnnouncedUp; // prevent sequential same-state announcements
CBDATA_CLASS2(ICAPServiceRep);
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic