summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ACM.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2018-03-20 21:18:10 +0100
committerBenoit Foucher <benoit@zeroc.com>2018-03-20 21:18:25 +0100
commita157ae70831fd23d0c27f118d108d7f13bce3b45 (patch)
treeae65d3dbfff9ef416e94e49a22d1a826d95a9e0c /cpp/src/Ice/ACM.cpp
parentRun JavaScript es6 test suite with Edge (diff)
downloadice-a157ae70831fd23d0c27f118d108d7f13bce3b45.tar.bz2
ice-a157ae70831fd23d0c27f118d108d7f13bce3b45.tar.xz
ice-a157ae70831fd23d0c27f118d108d7f13bce3b45.zip
Added sanity checks for ACM timeout value (ICE-8749)
Diffstat (limited to 'cpp/src/Ice/ACM.cpp')
-rw-r--r--cpp/src/Ice/ACM.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/cpp/src/Ice/ACM.cpp b/cpp/src/Ice/ACM.cpp
index b8e9878309a..cc20ccc070d 100644
--- a/cpp/src/Ice/ACM.cpp
+++ b/cpp/src/Ice/ACM.cpp
@@ -45,8 +45,17 @@ IceInternal::ACMConfig::ACMConfig(const Ice::PropertiesPtr& p,
timeoutProperty = prefix + ".Timeout";
};
- this->timeout = IceUtil::Time::seconds(p->getPropertyAsIntWithDefault(timeoutProperty,
- static_cast<int>(dflt.timeout.toSeconds())));
+ int timeout = p->getPropertyAsIntWithDefault(timeoutProperty, static_cast<int>(dflt.timeout.toSeconds()));
+ if(timeout >= 0)
+ {
+ this->timeout = IceUtil::Time::seconds(timeout);
+ }
+ else
+ {
+ l->warning("invalid value for property `" + timeoutProperty + "', default value will be used instead");
+ this->timeout = dflt.timeout;
+ }
+
int hb = p->getPropertyAsIntWithDefault(prefix + ".Heartbeat", static_cast<int>(dflt.heartbeat));
if(hb >= static_cast<int>(ICE_ENUM(ACMHeartbeat, HeartbeatOff)) &&
hb <= static_cast<int>(ICE_ENUM(ACMHeartbeat, HeartbeatAlways)))