def handle(req):
reqhandler.handle(request(bkreq=req, handler=reqhandler))
-ashd.util.serveloop(handle)
-reqhandler.close()
+try:
+ ashd.util.serveloop(handle)
+finally:
+ reqhandler.close()
def close(self):
self.sk.close()
-while True:
- nsk, addr = sk.accept()
- try:
- reqhandler.handle(request(sk=nsk, handler=reqhandler))
- finally:
- nsk.close()
+try:
+ while True:
+ nsk, addr = sk.accept()
+ try:
+ reqhandler.handle(request(sk=nsk, handler=reqhandler))
+ finally:
+ nsk.close()
+finally:
+ reqhandler.close()