[Medusa-dev] async question

lluis gomez i bigorda lluisgomez at hangar.org
Fri May 8 01:27:02 CEST 2009


hello all,

i'm justr trying to setup a simple server using medusa but I think I'm 
doing something wrong cause it's not async at all ::

my script is something like this ::



from socket import gethostname
from medusa.xmlrpc_handler import xmlrpc_handler
from medusa.http_server import http_server
import asyncore

class xmlrpc_server(xmlrpc_handler):
     # initialize and run the server
     def __init__(self, host=None, port=8182):
         if host is None:
             host = gethostname( )
         hs = http_server(host, port)
         hs.install_handler(self)
         asyncore.loop( )
     # an example of a method to be exposed via the XML-RPC protocol
     def add(self, op1, op2):
         return op1 + op2
     # an infinite loop
     def fuck(self, op1, op2):
         while (op1>2):
                 op1 = op2
         return False

     # the infrastructure ("plumbing") to expose methods
     def call(self, method, params):
         print "calling method: %s, params: %s" % (method, params)
         if method == 'add':
             return self.add(*params)
         if method == 'fuck':
             return self.fuck(*params)
         return "method not found: %s" % method
if __name__ == '__main__':
     server = xmlrpc_server( )



ok ... the server works but if one client call the procedure "fuck" the 
server will not attend any other petiotions  ...

can anybody explain what i'm missing please?

thank you very much in advance,

ll.


More information about the Medusa-dev mailing list