[Twisted-Python] XML-RPC, LineReceiver and defer
roland.hedberg at adm.umu.se
Wed Nov 24 03:27:55 EST 2004
I'm having problems with defer again :-(
There is something about defer's that I just don't get, obviously.
Anyway, I'd like to get tips on how to solve this problem:
I have a module who on one side listens on XML-RPC and on the other
uses the LineReceiver protocol to find some information it needs, to
service the XML-RFC function.
If I have understood it correctly xmlrpc.XMLRFC can return a defer and
have the XMLRPC layer hold the reply until some event has happend.
Now, the LineReceiver protocol has one function for sending a lines and
another function for receiving them.
So how do I make XMLRPC wait for the right line.
The XML-RPC server should of course be able to handle serveral requests
at the same time, so there might be more than one outstanding reply on
the lineReceiver side.
Knowing which reply that is connected to which sent line is doable by
keeping a queue and using IDs ( the protocol on the LineReceiver side,
which is no standard protocol, allows for having tags on queries and
But how do I keep the connection between the XML-RPC request and the
line received ?
I though about having defer checking for the change of a value in a
dictonary, but I don't know if that is doable, is it ?
And finally I don't want to use callLater if I can avoid it. I'd like
the performance to be as high as possible. That is, the XMLRPC reply
should be sent as soon as the LineReceiver has gotten the reply.
I also don't want to setup and tear down a connection on the
LineReceiver side for every request that comes in on the XMLRPC side.
There is one server on the LineReceiver side that gets all the
questions, so I liked to be able to have one connection going.
More information about the Twisted-Python