[Nym3-commit] r437 - trunk/nymbaron/Server
jr at conuropsis.org
jr at conuropsis.org
Sat Dec 10 00:33:22 CET 2005
Author: jr
Date: 2005-12-10 00:33:22 +0100 (Sat, 10 Dec 2005)
New Revision: 437
Modified:
trunk/nymbaron/Server/User.py
Log:
- debug encOldSyn (not tested yet) [server]
Modified: trunk/nymbaron/Server/User.py
===================================================================
--- trunk/nymbaron/Server/User.py 2005-12-04 00:22:07 UTC (rev 436)
+++ trunk/nymbaron/Server/User.py 2005-12-09 23:33:22 UTC (rev 437)
@@ -155,7 +155,7 @@
messages)
- usage is the volume of data in the account on the server
- quota is the maximum volume of data in the account on the server
- - index is a dixtionary mid -> (time, status) where time is the time at
+ - index is a dictionary mid -> (time, status) where time is the time at
which the message was received, and status describes the status of the
message (whereas synopsis was sent, wheres message has been
deleted...)
@@ -604,8 +604,11 @@
"""Replace in the synbox the syn between i and j-1
by an encrypted blob. Initially the syn have to be in clear
raise an error if it is not the case"""
- self.load_synbox()
- self.syn[i:j] = [self.blobify(self.syn[i:j])]
+ self.load_synbox()
+ l = self.syn[i:j]
+ if l == []:
+ return
+ self.syn[i:j] = [self.blobify(l)]
def encOldSyn(self):
"""Encrypt synopsis we had in clear for too long"""
@@ -622,15 +625,19 @@
self.encryptSyn(offset, offset + maxSynPerBlob)
offset = offset + 1
last = last - maxSynPerBlob
-
+
if offset + 1 >= last: return
# See if among the few remaining synopses, some are considered
# too old
try:
- fyoung = binsearch(self.syn, lambda x: self.index[x[0][0]]['time'] <
- time.time() - self['EncryptSummaryAfter'] * 30 * 60)
- except: pass
- if fyoung <= offset: return
+ now = time.time()
+ propyoung = lambda x: self.index[x[0][0]]['time'] +
+ self['EncryptSummaryAfter'] * 30 * 60) > now
+ fyoung = binsearch(self.syn[offset:], propyoung)
+ if fyoung == offset:
+ return
+ except:
+ fyoung = last
self.encryptSyn(offset, fyoung)
def markMid(self,l,mark):
More information about the Nym3-commit
mailing list