summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/Ice/ConnectionI.cpp38
-rw-r--r--cs/src/Ice/ConnectionI.cs41
-rw-r--r--java/src/Ice/ConnectionI.java42
-rw-r--r--js/src/Ice/ConnectionI.js38
4 files changed, 82 insertions, 77 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 3d267e765a2..d52e0867124 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -1216,27 +1216,29 @@ Ice::ConnectionI::setACM(const IceUtil::Optional<int>& timeout,
const IceUtil::Optional<Ice::ACMHeartbeat>& heartbeat)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(_monitor)
+ if(!_monitor || _state >= StateClosed)
{
- if(_state == StateActive)
- {
- _monitor->remove(this);
- }
- _monitor = _monitor->acm(timeout, close, heartbeat);
+ return;
+ }
- if(_monitor->getACM().timeout <= 0)
- {
- _acmLastActivity = IceUtil::Time(); // Disable the recording of last activity.
- }
- else if(_acmLastActivity == IceUtil::Time() && _state == StateActive)
- {
- _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
- }
+ if(_state == StateActive)
+ {
+ _monitor->remove(this);
+ }
+ _monitor = _monitor->acm(timeout, close, heartbeat);
- if(_state == StateActive)
- {
- _monitor->add(this);
- }
+ if(_monitor->getACM().timeout <= 0)
+ {
+ _acmLastActivity = IceUtil::Time(); // Disable the recording of last activity.
+ }
+ else if(_acmLastActivity == IceUtil::Time() && _state == StateActive)
+ {
+ _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic);
+ }
+
+ if(_state == StateActive)
+ {
+ _monitor->add(this);
}
}
diff --git a/cs/src/Ice/ConnectionI.cs b/cs/src/Ice/ConnectionI.cs
index cc5d2e3c5c5..cf5c3ef459c 100644
--- a/cs/src/Ice/ConnectionI.cs
+++ b/cs/src/Ice/ConnectionI.cs
@@ -793,28 +793,29 @@ namespace Ice
{
lock(this)
{
- if(_monitor != null)
+ if(_monitor == null || _state >= StateClosed)
{
- if(_state == StateActive)
- {
- _monitor.remove(this);
- }
- _monitor = _monitor.acm(timeout, close, heartbeat);
-
- if(_monitor.getACM().timeout <= 0)
- {
- _acmLastActivity = -1; // Disable the recording of last activity.
- }
- else if(_state == StateActive && _acmLastActivity == -1)
- {
- _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis();
- }
-
- if(_state == StateActive)
- {
- _monitor.add(this);
- }
+ return;
+ }
+ if(_state == StateActive)
+ {
+ _monitor.remove(this);
+ }
+ _monitor = _monitor.acm(timeout, close, heartbeat);
+
+ if(_monitor.getACM().timeout <= 0)
+ {
+ _acmLastActivity = -1; // Disable the recording of last activity.
+ }
+ else if(_state == StateActive && _acmLastActivity == -1)
+ {
+ _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis();
+ }
+
+ if(_state == StateActive)
+ {
+ _monitor.add(this);
}
}
}
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index ce29b34db9a..58f3f043ad4 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -752,29 +752,29 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
synchronized public void setACM(Ice.IntOptional timeout, Ice.Optional<ACMClose> close,
Ice.Optional<ACMHeartbeat> heartbeat)
{
- if(_monitor != null)
+ if(_monitor == null || _state >= StateClosed)
{
- if(_state == StateActive)
- {
- _monitor.remove(this);
- }
- _monitor = _monitor.acm(timeout, close, heartbeat);
-
- if(_monitor.getACM().timeout <= 0)
- {
- _acmLastActivity = -1; // Disable the recording of last
- // activity.
- }
- else if(_state == StateActive && _acmLastActivity == -1)
- {
- _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis();
- }
-
- if(_state == StateActive)
- {
- _monitor.add(this);
- }
+ return;
+ }
+ if(_state == StateActive)
+ {
+ _monitor.remove(this);
+ }
+ _monitor = _monitor.acm(timeout, close, heartbeat);
+
+ if(_monitor.getACM().timeout <= 0)
+ {
+ _acmLastActivity = -1; // Disable the recording of last activity.
+ }
+ else if(_state == StateActive && _acmLastActivity == -1)
+ {
+ _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis();
+ }
+
+ if(_state == StateActive)
+ {
+ _monitor.add(this);
}
}
diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js
index 0d8993381ec..8e38bceaade 100644
--- a/js/src/Ice/ConnectionI.js
+++ b/js/src/Ice/ConnectionI.js
@@ -704,25 +704,27 @@ var ConnectionI = Class({
},
setACM: function(timeout, close, heartbeat)
{
- if(this._monitor !== null)
+ if(this._monitor === null || this._state >= StateClosed)
{
- if(this._state == StateActive)
- {
- this._monitor.remove(this);
- }
- this._monitor = this._monitor.acm(timeout, close, heartbeat);
- if(this._state == StateActive)
- {
- this._monitor.add(this);
- }
- if(this._monitor.getACM().timeout <= 0)
- {
- this._acmLastActivity = -1; // Disable the recording of last activity.
- }
- else if(this._state == StateActive && this._acmLastActivity == -1)
- {
- this._acmLastActivity = Date.now();
- }
+ return;
+ }
+
+ if(this._state == StateActive)
+ {
+ this._monitor.remove(this);
+ }
+ this._monitor = this._monitor.acm(timeout, close, heartbeat);
+ if(this._state == StateActive)
+ {
+ this._monitor.add(this);
+ }
+ if(this._monitor.getACM().timeout <= 0)
+ {
+ this._acmLastActivity = -1; // Disable the recording of last activity.
+ }
+ else if(this._state == StateActive && this._acmLastActivity == -1)
+ {
+ this._acmLastActivity = Date.now();
}
},
getACM: function()