[FIX] netrpc_server: close as soon as possible the socket, and do it after a communication-level exception.

lp bug: https://launchpad.net/bugs/785009 fixed

bzr revid: vmt@openerp.com-20110606074856-e726j4klc5ljiq5w
This commit is contained in:
Vo Minh Thu 2011-06-06 09:48:56 +02:00
parent 7abcaedafc
commit f2770c9ac4
1 changed files with 4 additions and 0 deletions

View File

@ -87,11 +87,15 @@ class TinySocketClientThread(threading.Thread, netsvc.OpenERPDispatcher):
tb_s = "".join(traceback.format_exception(*tb))
logging.getLogger('web-services').debug("netrpc: communication-level exception", exc_info=True)
ts.mysend(e, exception=True, traceback=tb_s)
break
except Exception, ex:
#terminate this channel if we can't properly send back the error
logging.getLogger('web-services').exception("netrpc: cannot deliver exception message to client")
break
self.sock.shutdown(socket.SHUT_RDWR)
self.sock.close()
self.sock = None
self.threads.remove(self)
self.running = False
return True