Exemplo n.º 1
0
 def run(self, req):
     try:
         th = threading.current_thread()
         with self.lk:
             self.current.add(th)
             th.registered = True
             self.tcond.notify_all()
         try:
             env = req.mkenv()
             with perf.request(env) as reqevent:
                 respiter = req.handlewsgi(env, req.startreq)
                 for data in respiter:
                     req.write(data)
                 if req.status:
                     reqevent.response([req.status, req.headers])
                     req.flushreq()
                 self.ckflush(req)
         except closed:
             pass
         except:
             log.error("exception occurred when handling request", exc_info=True)
         finally:
             with self.lk:
                 self.current.remove(th)
                 self.tcond.notify_all()
     finally:
         req.close()
Exemplo n.º 2
0
 def handle(self, req):
     try:
         env = req.mkenv()
         with perf.request(env) as reqevent:
             respiter = req.handlewsgi(env, req.startreq)
             for data in respiter:
                 req.write(data)
             if req.status:
                 reqevent.response([req.status, req.headers])
                 req.flushreq()
             self.ckflush(req)
     except closed:
         pass
     except:
         log.error("exception occurred when handling request", exc_info=True)
     finally:
         req.close()