[Nym3-commit] r507 - trunk/nymbaron/Server
jr at conuropsis.org
jr at conuropsis.org
Mon Mar 27 22:38:45 CEST 2006
Author: jr
Date: 2006-03-27 22:38:44 +0200 (Mon, 27 Mar 2006)
New Revision: 507
Modified:
trunk/nymbaron/Server/User.py
Log:
- Rewrite encOldSyn
Modified: trunk/nymbaron/Server/User.py
===================================================================
--- trunk/nymbaron/Server/User.py 2006-03-27 20:38:00 UTC (rev 506)
+++ trunk/nymbaron/Server/User.py 2006-03-27 20:38:44 UTC (rev 507)
@@ -679,6 +679,9 @@
def encOldSyn(self):
"""Encrypt synopsis we had in clear for too long"""
+ now = time.time()
+ propyoung = lambda x: self.index[x[0][0]]['time'] +\
+ self['EncryptSummaryAfter'] * 30 * 60 > now
try:
firstclear = binsearch(self.syn, lambda x: (x[1] == 'clear'))
except IndexError:
@@ -688,26 +691,17 @@
last = len(self.syn)
size = last - offset
- while offset + maxSynPerBlob < last:
+ #while there is an old syn and there are enough to form a full block
+ while offset + maxSynPerBlob <= last and \
+ not propyoung(self.syn[offset]):
self.encryptSyn(offset, offset + maxSynPerBlob)
offset = offset + 1
- last = last - maxSynPerBlob
+ last = last - maxSynPerBlob + 1
+
+ #if we have not encoded everything that must be
+ if offset < last and not propyoung(self.syn[offset]):
+ self.encryptSyn(offset, last)
- if offset + 1 >= last:
- return
- # See if among the few remaining synopses, some are considered
- # too old
- try:
- now = time.time()
- propyoung = lambda x: self.index[x[0][0]]['time'] +\
- self['EncryptSummaryAfter'] * 30 * 60 > now
- fyoung = binsearch(self.syn[offset:], propyoung)
- except IndexError:
- #TODO this is not right, since it will not encrypt the last
- #element of the synbox as it should
- fyoung = last
- self.encryptSyn(offset, fyoung)
-
def markMid(self, l, mark):
"""The status of the mids in l which had a status
previous to mark in the lifeCycle are set to mark"""
More information about the Nym3-commit
mailing list