From 5d8e1e4e210410c6f5702a4348fceba80ba03af6 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Thu, 27 Nov 2014 15:43:19 -0200 Subject: If the client loses and restores it connection we must reset the u1db sync_target connection for it to be able to sync again --- client/src/leap/soledad/client/sqlcipher.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.2.3