diff options
author | Alan Conway <aconway@apache.org> | 2009-05-20 18:19:44 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-05-20 18:19:44 +0000 |
commit | b7b99eb789e893cbf0ff6bbf0b157d37d302f95f (patch) | |
tree | c18896a0f74f0b13c0b4d6f6a05e45d00a5b1ad9 /cpp/src | |
parent | 2ee35df0444e52ba7e24d8817110adbeaacb9e52 (diff) | |
download | qpid-python-b7b99eb789e893cbf0ff6bbf0b157d37d302f95f.tar.gz |
Add missing null body check in ErrorCheck
Make error checking optional.
This is temporary until all issues with it are worked out.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@776799 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/cluster/Cluster.cpp | 16 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/ClusterPlugin.cpp | 2 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/ClusterSettings.h | 5 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/ErrorCheck.cpp | 11 |
4 files changed, 23 insertions, 11 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index 58ac4b91b3..082e5488e8 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -338,7 +338,8 @@ void Cluster::deliveredEvent(const Event& e) { void Cluster::flagError(Connection& connection, ErrorCheck::ErrorType type) { Mutex::ScopedLock l(lock); - error.error(connection, type, map.getFrameSeq(), map.getMembers()); + if (settings.checkErrors) + error.error(connection, type, map.getFrameSeq(), map.getMembers()); } LATENCY_TRACK(sys::LatencyTracker<const AMQBody*> doOutputTracker("DoOutput");) @@ -350,9 +351,14 @@ void Cluster::deliveredFrame(const EventFrame& e) { LATENCY_TRACK(if (e.frame.getBody()->type() == CONTENT_BODY) doOutputTracker.start(e.frame.getBody())); Mutex::ScopedLock l(lock); // Process each frame through the error checker. - error.delivered(e); - while (error.canProcess()) // There is a frame ready to process. - processFrame(error.getNext(), l); + if (settings.checkErrors) { + error.delivered(e); + while (error.canProcess()) // There is a frame ready to process. + processFrame(error.getNext(), l); + } + else { + processFrame(e, l); + } } LATENCY_TRACK(sys::LatencyStatistic processLatency("Process");) @@ -707,7 +713,7 @@ std::ostream& operator<<(std::ostream& o, const Cluster& cluster) { }; assert(sizeof(STATE)/sizeof(*STATE) == Cluster::LEFT+1); o << cluster.self << "(" << STATE[cluster.state]; - if (cluster.error.isUnresolved()) o << "/error"; + if (cluster.settings.checkErrors && cluster.error.isUnresolved()) o << "/error"; return o << ")"; } diff --git a/cpp/src/qpid/cluster/ClusterPlugin.cpp b/cpp/src/qpid/cluster/ClusterPlugin.cpp index cb1212505b..daed608eb8 100644 --- a/cpp/src/qpid/cluster/ClusterPlugin.cpp +++ b/cpp/src/qpid/cluster/ClusterPlugin.cpp @@ -76,6 +76,8 @@ struct ClusterOptions : public Options { "Experimental: initial estimate for write rate per multicast cycle") ("cluster-write-min", optValue(settings.writeMin, "Kb"), "Experimental: minimum estimate for write rate per multicast cycle") + // FIXME aconway 2009-05-20: temporary + ("cluster-check-errors", optValue(settings.checkErrors, "yes|no"), "Enable/disable cluster error checks. Normally should be enabled.") ; } }; diff --git a/cpp/src/qpid/cluster/ClusterSettings.h b/cpp/src/qpid/cluster/ClusterSettings.h index 6b4a0b531c..8ae77cd807 100644 --- a/cpp/src/qpid/cluster/ClusterSettings.h +++ b/cpp/src/qpid/cluster/ClusterSettings.h @@ -34,8 +34,11 @@ struct ClusterSettings { bool quorum; size_t readMax, writeEstimate, writeMin; std::string username, password, mechanism; + bool checkErrors; - ClusterSettings() : quorum(false), readMax(10), writeEstimate(1), writeMin(1) {} + ClusterSettings() : quorum(false), readMax(10), writeEstimate(1), writeMin(1), + checkErrors(true) // FIXME aconway 2009-05-20: temporary + {} Url getUrl(uint16_t port) const { if (url.empty()) return Url::getIpAddressesUrl(port); diff --git a/cpp/src/qpid/cluster/ErrorCheck.cpp b/cpp/src/qpid/cluster/ErrorCheck.cpp index 6132d52126..87a7bb914b 100644 --- a/cpp/src/qpid/cluster/ErrorCheck.cpp +++ b/cpp/src/qpid/cluster/ErrorCheck.cpp @@ -60,11 +60,9 @@ void ErrorCheck::error(Connection& c, ErrorType t, uint64_t seq, const MemberSet void ErrorCheck::delivered(const EventFrame& e) { if (isUnresolved()) { - const ClusterErrorCheckBody* errorCheck = - dynamic_cast<const ClusterErrorCheckBody*>(e.frame.getMethod()); - const ClusterConfigChangeBody* configChange = - dynamic_cast<const ClusterConfigChangeBody*>(e.frame.getMethod()); - + const ClusterErrorCheckBody* errorCheck = 0; + if (e.frame.getBody()) + errorCheck = dynamic_cast<const ClusterErrorCheckBody*>(e.frame.getMethod()); if (errorCheck && errorCheck->getFrameSeq() == frameSeq) { // Same error if (errorCheck->getType() < type) { // my error is worse than his QPID_LOG(critical, cluster << " Error " << frameSeq << " did not occur on " << e.getMemberId()); @@ -78,6 +76,9 @@ void ErrorCheck::delivered(const EventFrame& e) { } else { frames.push_back(e); // Only drop matching errorCheck controls. + const ClusterConfigChangeBody* configChange = 0; + if (e.frame.getBody()) + configChange = dynamic_cast<const ClusterConfigChangeBody*>(e.frame.getMethod()); if (configChange) { MemberSet members(ClusterMap::decode(configChange->getCurrent())); MemberSet result; |