[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] add debugging messages to hashlog



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv19438/lib/mixminion/server

Modified Files:
	HashLog.py 
Log Message:
add debugging messages to hashlog

Index: HashLog.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/HashLog.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- HashLog.py	9 Jan 2003 06:28:58 -0000	1.4
+++ HashLog.py	9 Jan 2003 17:43:20 -0000	1.5
@@ -6,6 +6,7 @@
    Persistant memory for the hashed secrets we've seen.  Used by
    PacketHandler to prevent replay attacks."""
 
+import binascii
 import os
 import anydbm, dumbdbm
 import threading
@@ -89,8 +90,12 @@
             self.__lock.acquire()
             try:
                 if self.journal.get(hash,0):
+                    LOG.trace("Checking hash %s: seen recently",
+                              binascii.b2a_hex(hash))
                     return 1
                 _ = self.log[hash]
+                LOG.trace("Checking hash %s: seen a while ago",
+                          binascii.b2a_hex(hash))
                 return 1
             except KeyError:
                 return 0
@@ -100,8 +105,10 @@
     def logHash(self, hash):
         """Insert 'hash' into the database."""
         assert len(hash) == DIGEST_LEN
+        LOG.trace("Logging hash %s", binascii.b2a_hex(hash))
         try:
             self.__lock.acquire()
+            # XXX max journal size?
             self.journal[hash] = 1
             os.write(self.journalFile, hash)
         finally:
@@ -109,6 +116,7 @@
 
     def sync(self):
         """Flushes changes to this log to the filesystem."""
+        LOG.trace("Flushing hash log to disk")
         try:
             self.__lock.acquire()
             for hash in self.journal.keys():