SF.net SVN: fclient: [450] trunk/fcp2/src/fcp2/iohandler.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-01 08:03:18
|
Revision: 450
http://fclient.svn.sourceforge.net/fclient/?rev=450&view=rev
Author: jUrner
Date: 2008-07-01 01:03:27 -0700 (Tue, 01 Jul 2008)
Log Message:
-----------
added hack to handle persistents from other clients (kill them with fire ;-)
Modified Paths:
--------------
trunk/fcp2/src/fcp2/iohandler.py
Modified: trunk/fcp2/src/fcp2/iohandler.py
===================================================================
--- trunk/fcp2/src/fcp2/iohandler.py 2008-07-01 07:22:08 UTC (rev 449)
+++ trunk/fcp2/src/fcp2/iohandler.py 2008-07-01 08:03:27 UTC (rev 450)
@@ -258,8 +258,11 @@
raise consts.IOTimeoutError(details)
- def readMessage(self):
+ def readMessage(self, hackyInvalidMessageCallback=None):
"""Reads the next message from io device
+ @param hackyInvalidMessageCallback: in case a message drops in we can't handle this callback
+ will be called emidiately before raising, giving the caller a chance to do something about it.....
+
@return: (Message) next message from the socket
@raise IOBrokenError: (L{consts.IOBrokenError}) if the io breaks unexpectedly
@@ -305,12 +308,18 @@
# process param --> value fields
params = dict([line.split('=', 1) for line in p])
if not msg._restoreParams(params):
+ #HACK:
+ if hackyInvalidMessageCallback is not None:
+ hackyInvalidMessageCallback(msg)
raise consts.MessageParseError('Invalid message parameters: ' + msg.pprint(), consts.Logger.IOHandler.error)
# get associated data if necessary
if mayHaveData:
n = msg._getDataLength()
if not isinstance(n, (int, long)):
+ #HACK:
+ if hackyInvalidMessageCallback is not None:
+ ackyInvalidMessageCallback(msg)
raise consts.MessageParseError('DataLength must be type(int)')
if n > 0:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|