diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-09-18 10:40:10 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-09-18 10:40:10 +0200 |
commit | cfae4509c7b88b26a9113451bfae649682d7cac6 (patch) | |
tree | 8ecaef8e95070a4ff1b390addd980f3a929760a0 | |
parent | Fixed bug #2461 (diff) | |
download | ice-cfae4509c7b88b26a9113451bfae649682d7cac6.tar.bz2 ice-cfae4509c7b88b26a9113451bfae649682d7cac6.tar.xz ice-cfae4509c7b88b26a9113451bfae649682d7cac6.zip |
Fixed bug 2462 and bug in IceUtil::Timer
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.cpp | 51 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.h | 20 | ||||
-rwxr-xr-x | cpp/src/IceUtil/Timer.cpp | 2 |
3 files changed, 38 insertions, 35 deletions
diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index c41aa5c04de..1368294a5c5 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -1195,19 +1195,20 @@ ServiceHelper::ServiceHelper(const ServiceDescriptorPtr& descriptor) : } bool -ServiceHelper::operator==(const ServiceHelper& helper) const +ServiceHelper::operator==(const CommunicatorHelper& h) const { - if(!CommunicatorHelper::operator==(helper)) + const ServiceHelper* helper = dynamic_cast<const ServiceHelper*>(&h); + if(!helper || !CommunicatorHelper::operator==(h)) { return false; } - if(_desc->name != helper._desc->name) + if(_desc->name != helper->_desc->name) { return false; } - if(_desc->entry != helper._desc->entry) + if(_desc->entry != helper->_desc->entry) { return false; } @@ -1216,7 +1217,7 @@ ServiceHelper::operator==(const ServiceHelper& helper) const } bool -ServiceHelper::operator!=(const ServiceHelper& helper) const +ServiceHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } @@ -1272,66 +1273,67 @@ ServerHelper::ServerHelper(const ServerDescriptorPtr& descriptor) : } bool -ServerHelper::operator==(const ServerHelper& helper) const +ServerHelper::operator==(const CommunicatorHelper& h) const { - if(!CommunicatorHelper::operator==(helper)) + const ServerHelper* helper = dynamic_cast<const ServerHelper*>(&h); + if(!helper || !CommunicatorHelper::operator==(h)) { return false; } - if(_desc->id != helper._desc->id) + if(_desc->id != helper->_desc->id) { return false; } - if(_desc->exe != helper._desc->exe) + if(_desc->exe != helper->_desc->exe) { return false; } - if(_desc->pwd != helper._desc->pwd) + if(_desc->pwd != helper->_desc->pwd) { return false; } if(set<string>(_desc->options.begin(), _desc->options.end()) != - set<string>(helper._desc->options.begin(), helper._desc->options.end())) + set<string>(helper->_desc->options.begin(), helper->_desc->options.end())) { return false; } if(set<string>(_desc->envs.begin(), _desc->envs.end()) != - set<string>(helper._desc->envs.begin(), helper._desc->envs.end())) + set<string>(helper->_desc->envs.begin(), helper->_desc->envs.end())) { return false; } - if(_desc->activation != helper._desc->activation) + if(_desc->activation != helper->_desc->activation) { return false; } - if(_desc->activationTimeout != helper._desc->activationTimeout) + if(_desc->activationTimeout != helper->_desc->activationTimeout) { return false; } - if(_desc->deactivationTimeout != helper._desc->deactivationTimeout) + if(_desc->deactivationTimeout != helper->_desc->deactivationTimeout) { return false; } - if(_desc->distrib != helper._desc->distrib) + if(_desc->distrib != helper->_desc->distrib) { return false; } - if(_desc->allocatable != helper._desc->allocatable) + if(_desc->allocatable != helper->_desc->allocatable) { return false; } - if(_desc->user != helper._desc->user) + if(_desc->user != helper->_desc->user) { return false; } @@ -1340,7 +1342,7 @@ ServerHelper::operator==(const ServerHelper& helper) const } bool -ServerHelper::operator!=(const ServerHelper& helper) const +ServerHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } @@ -1483,14 +1485,15 @@ IceBoxHelper::IceBoxHelper(const IceBoxDescriptorPtr& descriptor) : } bool -IceBoxHelper::operator==(const IceBoxHelper& helper) const +IceBoxHelper::operator==(const CommunicatorHelper& h) const { - if(!ServerHelper::operator==(helper)) + const IceBoxHelper* helper = dynamic_cast<const IceBoxHelper*>(&h); + if(!helper || !ServerHelper::operator==(h)) { return false; } - - if(_services != helper._services) + + if(_services != helper->_services) { return false; } @@ -1499,7 +1502,7 @@ IceBoxHelper::operator==(const IceBoxHelper& helper) const } bool -IceBoxHelper::operator!=(const IceBoxHelper& helper) const +IceBoxHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } diff --git a/cpp/src/IceGrid/DescriptorHelper.h b/cpp/src/IceGrid/DescriptorHelper.h index e222940686c..f16d50afb71 100644 --- a/cpp/src/IceGrid/DescriptorHelper.h +++ b/cpp/src/IceGrid/DescriptorHelper.h @@ -86,8 +86,8 @@ public: CommunicatorHelper() { } virtual ~CommunicatorHelper() { } - bool operator==(const CommunicatorHelper&) const; - bool operator!=(const CommunicatorHelper&) const; + virtual bool operator==(const CommunicatorHelper&) const; + virtual bool operator!=(const CommunicatorHelper&) const; virtual void getIds(std::multiset<std::string>&, std::multiset<Ice::Identity>&) const; virtual void getReplicaGroups(std::set<std::string>&) const; @@ -115,8 +115,8 @@ public: ServiceHelper(const ServiceDescriptorPtr&); ServiceHelper() { } - bool operator==(const ServiceHelper&) const; - bool operator!=(const ServiceHelper&) const; + virtual bool operator==(const CommunicatorHelper&) const; + virtual bool operator!=(const CommunicatorHelper&) const; ServiceDescriptorPtr getDescriptor() const; ServiceDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, @@ -141,8 +141,8 @@ public: ServerHelper(const ServerDescriptorPtr&); ServerHelper() { } - bool operator==(const ServerHelper&) const; - bool operator!=(const ServerHelper&) const; + virtual bool operator==(const CommunicatorHelper&) const; + virtual bool operator!=(const CommunicatorHelper&) const; ServerDescriptorPtr getDescriptor() const; virtual ServerDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, @@ -203,8 +203,8 @@ public: IceBoxHelper(const IceBoxDescriptorPtr&); IceBoxHelper() { } - bool operator==(const IceBoxHelper&) const; - bool operator!=(const IceBoxHelper&) const; + virtual bool operator==(const CommunicatorHelper&) const; + virtual bool operator!=(const CommunicatorHelper&) const; virtual ServerDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, const PropertySetDescriptorDict&) const; @@ -267,8 +267,8 @@ public: NodeHelper(const std::string&, const NodeDescriptor&, const Resolver&, bool); virtual ~NodeHelper() { } - bool operator==(const NodeHelper&) const; - bool operator!=(const NodeHelper&) const; + virtual bool operator==(const NodeHelper&) const; + virtual bool operator!=(const NodeHelper&) const; NodeUpdateDescriptor diff(const NodeHelper&) const; NodeDescriptor update(const NodeUpdateDescriptor&, const Resolver&) const; diff --git a/cpp/src/IceUtil/Timer.cpp b/cpp/src/IceUtil/Timer.cpp index fd80db92f2c..adca267c58e 100755 --- a/cpp/src/IceUtil/Timer.cpp +++ b/cpp/src/IceUtil/Timer.cpp @@ -152,8 +152,8 @@ Timer::run() const Token& first = *(_tokens.begin()); if(first.scheduledTime <= now) { - _tokens.erase(_tokens.begin()); token = first; + _tokens.erase(_tokens.begin()); if(token.delay == IceUtil::Time()) { _tasks.erase(token.task); |