SF.net SVN: fclient: [235] trunk/sandbox/fcp/fcp2_0_client.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <ju...@us...> - 2008-02-20 17:48:44
|
Revision: 235
http://fclient.svn.sourceforge.net/fclient/?rev=235&view=rev
Author: jurner
Date: 2008-02-20 09:48:09 -0800 (Wed, 20 Feb 2008)
Log Message:
-----------
fix: run() method now waits a while to see if persistent requests are waiting
Modified Paths:
--------------
trunk/sandbox/fcp/fcp2_0_client.py
Modified: trunk/sandbox/fcp/fcp2_0_client.py
===================================================================
--- trunk/sandbox/fcp/fcp2_0_client.py 2008-02-18 22:00:55 UTC (rev 234)
+++ trunk/sandbox/fcp/fcp2_0_client.py 2008-02-20 17:48:09 UTC (rev 235)
@@ -281,6 +281,7 @@
# basic sizes of keys are: 1k for SSks and 32k for CHKs
# without MaxSize DataFound will have DataLength set to 0 (?!)
MaxSizeKeyInfo = 32768
+ MinimumRunTime = 1 # minimum time (seconds) the client will run when run() is called (FIX: 0001931)
SocketTimeout = 0.1
ExpectedFcpVersion = 2.0
ExpectedNodeBuild = 1107
@@ -923,7 +924,6 @@
# For GetData with persistence != connection the node sends no All Data message
# whatever that is good for ..fix this here to get all GetData request to complete on
# All Data, too.
- # Note: All other requests are completed here.
if initialRequest['FcRequestType'] == consts.RequestType.GetData:
if initialRequest['Persistence'] != consts.Persistence.Connection:
self.sendMessage(
@@ -1284,11 +1284,23 @@
@note: a KeyboardInterrupt will stop the client
"""
+ #FIX: 0001931
+ # poll a few times to see if there are persistent requests waiting
+ t0 = time.time()
+ while time.time() - t0 <= self.MinimumRunTime:
+ try:
+ msg = self.next()
+ except KeyboardInterrupt:
+ self._logRuntime.info(consts.LogMessages.KeyboardInterrupt)
+ return
+ if msg.name == consts.Message.ClientSocketDied:
+ return
+
#n = 0
while True:
#n += 1
#if n > 50: break
-
+
# check if we have running requests. Assert False
haveRunningRequests = False
for request in self._requests.values():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|