summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-11-27 15:43:19 -0200
committerDuda Dornelles <ddornell@thoughtworks.com>2014-11-27 16:48:56 -0200
commit5d8e1e4e210410c6f5702a4348fceba80ba03af6 (patch)
treec9930788b93a4c45d2c6b1746ca6366c9be21135
parent7814e69a1057e3c1d563748d631e3add9c4c40ac (diff)
If the client loses and restores it connection we must reset the u1db sync_target connection for it to be able to sync again
-rw-r--r--client/src/leap/soledad/client/sqlcipher.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/client/src/leap/soledad/client/sqlcipher.py b/client/src/leap/soledad/client/sqlcipher.py
index b7de2fba..26e74ef5 100644
--- a/client/src/leap/soledad/client/sqlcipher.py
+++ b/client/src/leap/soledad/client/sqlcipher.py
@@ -52,6 +52,7 @@ import json
from hashlib import sha256
from contextlib import contextmanager
from collections import defaultdict
+from httplib import CannotSendRequest
from pysqlcipher import dbapi2
from u1db.backends import sqlite_backend
@@ -486,6 +487,11 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase):
except PendingReceivedDocsSyncError:
logger.warning("Local sync db is not clear, skipping sync...")
return
+ except CannotSendRequest:
+ logger.warning("Connection with sync target couldn't be established. Resetting connection...")
+ # closing the connection it will get it recreated in the next try
+ syncer.sync_target.close()
+ return
return res