proxy.connect()
self.proxies[session] = proxy
- multitask.add(self.proxy_relay(reqtype))
+ yield self.proxy_relay(reqtype)
- return True
+ #while p.serving:
+ # (yield multitask.sleep(0.01))
+
+ raise StopIteration
def onPOST(self, client, *args):
"""Serve a POST request."""
- return self.on_query(client, "POST", *args)
+ yield self.on_query(client, "POST", *args)
def onGET(self, client, *args):
"""Serve a GET request."""
- return self.on_query(client, "GET", *args)
+ yield self.on_query(client, "GET", *args)
def proxy_relay(self, reqtype):
session = self.client.session
p = self.proxies[session]
- #while p.serving:
- # (yield multitask.sleep(0.01))
p.serving = True
try:
print 'proxy wants client to close_connection'
try:
yield self.client.connectionClosed()
+ p.serving = False
raise httpd.ConnectionClosed
except httpd.ConnectionClosed:
if self.debuglevel > 0:
if self.debuglevel > 0:
print traceback.print_exc()
-
+ p.serving = False
raise StopIteration
if _debug:
print methodname, dir(inst)
method = getattr(inst, methodname, None)
- result = method(client, msg)
+ yield method(client, msg)
+ result = None
close_connection = msg.close_connection
if _debug:
print "close connection", close_connection