Reconnect in db_exec on network error for issue1387

This commit is contained in:
Cédric Krier committed 2010-03-18 15:29:16 +01:00
1 parent 82343a2978
commit 048fe8f4dd
1 file changed
+8 -1
+8 -1
View File
@@ -60,7 +60,14 @@ def db_exec(host, port, method, *args):
_SOCK.connect(host, port)
args = (None, None, None, 'common', 'db', method) + args
logging.getLogger('rpc.request').info(repr(args))
_SOCK.send(args)
try:
_SOCK.send(args)
except Exception, exception:
if exception[0] == 32:
_SOCK.reconnect()
_SOCK.send(args)
else:
raise
res = _SOCK.receive()
SECURE = _SOCK.ssl
finally: