Dirk Meyer wrote: > Dirk Meyer wrote: >> "Duncan Webb" wrote: >>> The only thing that I've not researched yet is how to replace the reactor >>> loop, subclassing SimpleXMLRPCServer may be the solution for this. >> Maybe use kaa.notifier as basic framework. Doing this would make the >> code compatible with 2.0. We only need to feed xmlrpc into >> kaa.notifier and we are done. > > If you only need the server: > > | import kaa.notifier > | from SimpleXMLRPCServer import SimpleXMLRPCServer > | > | class XMLRPCServer(SimpleXMLRPCServer): > | > | allow_reuse_address = True > | > | def register_function(self, function, name = None): > | if not name: > | name = function.__name__ > | c = kaa.notifier.MainThreadCallback(function) > | c.set_async(False) > | SimpleXMLRPCServer.register_function(self, c, name) > | > | def _handle_request(self): > | kaa.notifier.Thread(self.handle_request).start() > | > | def serve_forever(self): > | > kaa.notifier.WeakSocketDispatcher(self._handle_request).register(self.fileno()) > | kaa.signals['shutdown'].connect_weak(self.server_close) > > That should be it. It's a bad hack to use threads to avoid the > mainloop blocking. Well, it works. > > Use register_function and serve_forever as described in > http://docs.python.org/lib/simple-xmlrpc-servers.html > and start the mainloop with kaa.notifier.loop()
Thanks dischi, So do it will act just like the examples in the library manual? Attached was a quick test that I did from the examples in the book Also attached is a pcqueue.py example that I found on the net. The code is for a producer/consumer queue which would be good for internal events. May be the record server sends events to itself which should be handled in a thread. Things like start and stop a recording. You may already have something like this, I've not checked out the notifier code yet. I think this discussion should be on the devel list. Duncan
pcqueue.py
Description: application/python
xmlrpc-srv.py
Description: application/python
xmlrpc-cli.py
Description: application/python
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel