summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-08-04 16:48:21 -0300
committerdrebs <drebs@leap.se>2014-08-08 11:49:03 -0300
commitafdb1cefe605cabfe325df3124b9beb3174568ff (patch)
treeddfd62a861a1bd6c035d60ef9222eb18102e6cc9 /client
parent30aa5c040c093aa82be09e94dd403c18597320e5 (diff)
Delete the received docs from sync db before starting a new sync.
Diffstat (limited to 'client')
-rw-r--r--client/src/leap/soledad/client/crypto.py7
-rw-r--r--client/src/leap/soledad/client/target.py3
2 files changed, 9 insertions, 1 deletions
diff --git a/client/src/leap/soledad/client/crypto.py b/client/src/leap/soledad/client/crypto.py
index 1b01913d..a24f2053 100644
--- a/client/src/leap/soledad/client/crypto.py
+++ b/client/src/leap/soledad/client/crypto.py
@@ -986,3 +986,10 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
else:
# If no errors found, remove it from the received database.
self.delete_received_doc(doc_id, doc_rev)
+
+ def empty(self):
+ """
+ Empty the received docs table of the sync database.
+ """
+ sql = "DELETE FROM %s WHERE 1" % (self.TABLE_NAME,)
+ res = self._sync_db.execute(sql)
diff --git a/client/src/leap/soledad/client/target.py b/client/src/leap/soledad/client/target.py
index 12175f48..1cb02856 100644
--- a/client/src/leap/soledad/client/target.py
+++ b/client/src/leap/soledad/client/target.py
@@ -1149,8 +1149,9 @@ class SoledadSyncTarget(HTTPSyncTarget, TokenBasedAuth):
setProxiedObject(self._insert_doc_cb[source_replica_uid],
return_doc_cb)
+ # empty the database before starting a new sync
if defer_decryption is True and not self.clear_to_sync():
- raise PendingReceivedDocsSyncError
+ self._sync_decr_pool.empty()
self._ensure_connection()
if self._trace_hook: # for tests