Revision: 591
http://fclient.svn.sourceforge.net/fclient/?rev=591&view=rev
Author: jUrner
Date: 2008-07-12 06:38:25 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
fixed duration calculation
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/client.py
trunk/fclient/src/fclient/lib/fcp2/iohandler.py
Modified: trunk/fclient/src/fclient/lib/fcp2/client.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-12 11:12:59 UTC (rev 590)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-12 13:38:25 UTC (rev 591)
@@ -486,7 +486,7 @@
msg = self.next(dispatch=False)
if msg == message.MsgClientSocketTimeout:
disconnectReason = consts.ConstDisconnectReason.NoNodeHello
- timeElapsed += max(self.ioHandler.io.Timeout, 0.1)
+ timeElapsed += time.time() - t0
yield None
elif msg == message.MsgNodeHello:
self._nodeHelloMessage = msg
@@ -506,6 +506,7 @@
DisconnectReason=disconnectReason,
)
self._close(disconnectMsg)
+ consts.ConstLogger.Client.info(consts.ConstLogMessages.ConnectingFailed)
raise StopIteration
Modified: trunk/fclient/src/fclient/lib/fcp2/iohandler.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/iohandler.py 2008-07-12 11:12:59 UTC (rev 590)
+++ trunk/fclient/src/fclient/lib/fcp2/iohandler.py 2008-07-12 13:38:25 UTC (rev 591)
@@ -190,7 +190,8 @@
if not timeout >= 0:
raise ValueError('timeout must be >= 0')
- timeElapsed = 0
+ t0 = time.time()
+ timeElapsed = time.time() - t0
while timeElapsed <= duration:
if self.isOpen():
self.close()
@@ -209,7 +210,7 @@
# continue polling
consts.ConstLogger.IOHandler.info(consts.ConstLogMessages.RetryingConnect)
- timeElapsed += timeout
+ timeElapsed += time.time() - t0
time.sleep(timeout)
raise StopIteration
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|