aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2021-06-24 11:25:29 -0300
committerJason Gunthorpe <jgg@nvidia.com>2021-06-24 11:25:29 -0300
commit7aaa4abeeef7b424a67a3bdca1a67e96d9bd2dd8 (patch)
tree6ed7e029bce1ae30b99047f32058d1dd14a5b6a1
parent83ee7cade37b23f608823f2ed59a1c315b7e9478 (diff)
downloadcloud_mdir_sync-master.tar.gz
cloud_mdir_sync-master.tar.bz2
cloud_mdir_sync-master.zip
util: Do not store "" as the message CHHEADmaster
This was causing assertions if this condition was ever hit. Instead just delete the corrupted message id. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-rw-r--r--cloud_mdir_sync/messages.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/cloud_mdir_sync/messages.py b/cloud_mdir_sync/messages.py
index 73cbf80..fd8922d 100644
--- a/cloud_mdir_sync/messages.py
+++ b/cloud_mdir_sync/messages.py
@@ -211,8 +211,9 @@ class MessageDB(object):
for cid,ch in res.items():
ncid = (cid[0], cid[1], None)
if no_msg_id.get(ncid, ch) != ch:
- ch = ""
- no_msg_id[ncid] = ch
+ del no_msg_id[ncid]
+ else:
+ no_msg_id[ncid] = ch
self.content_hashes_cloud = no_msg_id
def _sha1_fn(self, fn):
@@ -297,7 +298,7 @@ class MessageDB(object):
"""Return a file for later use by store_hashed_file"""
return tempfile.NamedTemporaryFile(dir=self.hashes_dir)
- def store_hashed_msg(self, msg, tmpf):
+ def store_hashed_msg(self, msg : Message, tmpf):
"""Retain the content tmpf in the hashed file database"""
tmpf.flush()
ch = self._sha1_fn(tmpf.name)
@@ -317,8 +318,6 @@ class MessageDB(object):
cid = msg.cid()
self.content_hashes[msg.cid()] = ch
ncid = (cid[0], cid[1], None)
- if self.content_hashes_cloud.get(ncid, ch) != ch:
- ch = ""
self.content_hashes_cloud[ncid] = ch
assert self.have_content(msg)