Hi there,
Yesterday I got disconnected from MSN and when trying to reconnect,
the Notification Server that I get referred to from the DispatchServer
will send me another XFR to yet a different NS. pyMSNt will then error
out with an error message about an unexpected XFR response, because in
legacy/msn/msn.py, there is no callback function that _fireCallback
can call.
I don't have much experience with python and/or twisted and the
pyMSNt, but I managed to work around this problem in the following
way: I removed the error raising code and instead connect to the new
NS, if no callback can be found. If anyone knows the code and knows
how to instead add a proper callback function that can be fired, I'd
be happy to know as I don't really like uninformed ugly hacks like the
one I just made :)
In the meantime, the following patch can be used as the described
workaround. I also had to make sure that the NotificationClient is not
destroyed when the first NS drops the connection after the referral.
Tabs will probably be changed into spaces so you might want to check
the indentation after applying the patch.
diff -urw src-old/legacy/glue.py src/legacy/glue.py
--- src-old/legacy/glue.py 2008-02-21 19:39:03.000000000 +0100
+++ src/legacy/glue.py 2008-06-05 20:41:40.000000000 +0200
@@ -383,6 +383,12 @@
def connectionLost(self, reason):
LogEvent(INFO, self.jabberID)
+ # If we got a second referral, don't really log out but let the
next NS
+ # try to log us in
+ if reason.type == error.ConnectionDone and self.gotadditionalXFR !
= 0:
+ LogEvent(INFO, self.ident)
+ return
+
if reason.type != error.ConnectionDone:
text = lang.get(self.session.lang).msnDisconnected % reason
self.session.sendMessage(to=self.jabberID, fro=config.jid,
body=text)
diff -urw src/legacy/msn/msn.py /usr/local/pymsnt/src/legacy/msn/
msn.py
--- src-old/legacy/msn/msn.py 2008-02-08 14:55:07.000000000 +0100
+++ src/legacy/msn/msn.py 2008-06-05 20:44:38.000000000 +0200
@@ -1347,7 +1347,8 @@
port = MSN_PORT
if not self._fireCallback(id, host, int(port), params[4]):
- raise MSNProtocolError, "Got XFR (referral) that I didn't
ask for .. should this happen?" # debug
+ self.factory.msncon.gotadditionalXFR = 1
+
self.factory.msncon.connectors.append(reactor.connectTCP(host,
int(port), self.factory, bindAddress=(self.factory.msncon.BINDADDRESS,
0)))
def handle_RNG(self, params):
checkParamLen(len(params), 6, 'RNG')
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"py-transports" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/py-transports?hl=en
-~----------~----~----~----~------~----~------~--~---