From 40cef7d36084fbe86d34cfa497628d8972c4c9e7 Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Thu, 29 Mar 2007 17:53:41 +0000
Subject: [PATCH]
---
opends/src/server/org/opends/server/synchronization/protocol/SocketSession.java | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/synchronization/protocol/SocketSession.java b/opends/src/server/org/opends/server/synchronization/protocol/SocketSession.java
index b57cc5d..d1ceb76 100644
--- a/opends/src/server/org/opends/server/synchronization/protocol/SocketSession.java
+++ b/opends/src/server/org/opends/server/synchronization/protocol/SocketSession.java
@@ -112,11 +112,16 @@
/* Read the first 8 bytes containing the packet length */
int length = 0;
+ /* Let's start the stop-watch before waiting on read */
+ /* for the heartbeat check to be operationnal */
+ lastReceiveTime = System.currentTimeMillis();
+
while (length<8)
{
int read = input.read(rcvLengthBuf, length, 8-length);
if (read == -1)
{
+ lastReceiveTime=0;
throw new IOException("no more data");
}
else
@@ -135,8 +140,9 @@
{
length += input.read(buffer, length, totalLength - length);
}
-
- lastReceiveTime = System.currentTimeMillis();
+ /* We do not want the heartbeat to close the session when */
+ /* we are processing a message even a time consuming one. */
+ lastReceiveTime=0;
return SynchronizationMessage.generateMsg(buffer);
}
catch (OutOfMemoryError e)
@@ -159,6 +165,10 @@
*/
public long getLastReceiveTime()
{
+ if (lastReceiveTime==0)
+ {
+ return System.currentTimeMillis();
+ }
return lastReceiveTime;
}
--
Gitblit v1.10.0