SF.net SVN: fclient: [371] trunk/sandbox/fcp2/iohandler.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-04-08 10:06:41
|
Revision: 371
http://fclient.svn.sourceforge.net/fclient/?rev=371&view=rev
Author: jUrner
Date: 2008-04-08 03:06:09 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
some fixes
Modified Paths:
--------------
trunk/sandbox/fcp2/iohandler.py
Modified: trunk/sandbox/fcp2/iohandler.py
===================================================================
--- trunk/sandbox/fcp2/iohandler.py 2008-04-08 10:05:01 UTC (rev 370)
+++ trunk/sandbox/fcp2/iohandler.py 2008-04-08 10:06:09 UTC (rev 371)
@@ -11,7 +11,7 @@
import traceback
-#--> rel import hack
+#--> rel import hack, so we don't have to put the package on sys.path
class _RelImportHack(object):
def __init__(self, n):
fpath = os.path.abspath(__file__)
@@ -138,7 +138,10 @@
def write(self, bytes):
try:
- self.socket.sendall(bytes)
+ totalSend = 0
+ while totalSend < len(bytes):
+ n = self.io.write(bytes[totalSend: ])
+ totalSend += n
except socket.error, details:
self.close()
raise IOHandler.IOBroken(details)
@@ -225,6 +228,7 @@
self._log.info(consts.LogMessages.Connecting + ' %r' % kwargs)
self.io = self._ioPrototype()
+ self.io.setTimeout(self.io.Timeout)
yield False # have to yield at least once to make unittests work (io has to be created!!)
try:
self.io.connect(**kwargs)
@@ -232,7 +236,6 @@
self._log.info(consts.LogMessages.ConnectingFailed + ' %s %s' % (self.IOConnectFailed, details))
yield False
else:
- self.io.setTimeout(self.io.Timeout)
self._log.info(consts.LogMessages.Connected)
yield True
break
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|