[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Documentation cleanups throughout the code; remove some...



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

Modified Files:
	Modules.py PacketHandler.py ServerConfig.py ServerKeys.py 
	ServerMain.py ServerQueue.py 
Log Message:
Documentation cleanups throughout the code; remove some obsolete stuff; kill bad whitespace; update copyright dates

Index: Modules.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Modules.py,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- Modules.py	25 Feb 2004 06:03:11 -0000	1.72
+++ Modules.py	6 Mar 2004 00:04:38 -0000	1.73
@@ -66,7 +66,10 @@
         pass
 
     def usesDecodingHandle(self):
-        """DOCDOC"""
+        """Return true iff this module expects to find decoding handles on
+           routinginfo fields.  This should be used by any module that
+           expects to receive replies or forward encrypted messages as
+           described in E2E-spec.txt"""
         return 1
 
     def getRetrySchedule(self):
@@ -146,7 +149,6 @@
     #  module: the underlying DeliveryModule object.
     def __init__(self, module):
         self.module = module
-        self.hasTag = 1
 
     def queueDeliveryMessage(self, packet, retry=0, lastAttempt=0):
         """Instead of queueing our message, pass it directly to the underlying
@@ -965,7 +967,7 @@
     #   base64) for outgoing messages.
     # allowFromAddr: Boolean: do we support user-supplied from addresses?
 
-    COMMON_OPTIONS = { 
+    COMMON_OPTIONS = {
         'MaximumSize' : ('ALLOW', "size", "100K"),
         'AllowFromAddress' : ('ALLOW', "boolean", "yes"),
         'SubjectLine' : ('ALLOW', None,
@@ -976,7 +978,7 @@
         'FromTag' : ('ALLOW', None, "[Anon]"),
         'ReturnAddress' : ('ALLOW', None, None),
         }
-        
+
     def _formatEmailMessage(self, address, packet):
         """Given a RFC822 mailbox (delivery address), and an instance of
            DeliveryMessage, return a string containing a message to be sent
@@ -1014,7 +1016,7 @@
         return msg
 
     def initializeHeaders(self, sec):
-        """Sets subject and returns a string that can be added to message 
+        """Sets subject and returns a string that can be added to message
            headers."""
         # set subject
         self.subject = _wrapHeader(sec.get("SubjectLine").strip()).strip()
@@ -1423,7 +1425,6 @@
        for an outgoing email message.  Raise ParseError if they are not."""
     for k in headers.keys():
         if k not in MAIL_HEADERS:
-            #XXXX this should raise parse error instead.
             LOG.warn("Skipping unrecognized mail header %s"%k)
 
     fromAddr = headers['FROM']

Index: PacketHandler.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/PacketHandler.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- PacketHandler.py	21 Feb 2004 00:02:09 -0000	1.36
+++ PacketHandler.py	6 Mar 2004 00:04:38 -0000	1.37
@@ -304,10 +304,13 @@
         self.isfrag = 0
         self.dPayload = None
         self.error = None
-        self.hasTag = 0 # XXXX007 DOCDOC
 
     def setTagged(self,tagged=1):
-        self.hasTag=tagged
+        """Re-frame the routingInfo in this packet. If 'tagged' is true,
+           then the routingInfo starts with TAG_LEN bytes of decoding
+           handle, and the rest is address.  If 'tagged' is false, then
+           it's all address.
+        """
         x = self.tag+self.address
         if tagged:
             if len(x)<Packet.TAG_LEN:
@@ -322,22 +325,14 @@
         return "V0", self.__dict__
 
     def __setstate__(self, state):
-        if type(state) == types.DictType:
-            #XXXX007 remove this case.  (Not used since 0.0.5alpha)
-            LOG.warn("Found ancient packet format.")
-            self.__dict__.update(state)
-            if not hasattr(self, 'isfrag'):
-                self.isfrag = 0
-            if not hasattr(self, 'dPayload'):
-                self.dPayload = None
-            if not hasattr(self, 'error'):
-                self.error = None
-            if not hasattr(self, 'headers'):
-                self.headers = {}
-        elif state[0] == 'V0':
-            self.__dict__.update(state[1])
+        if type(state) == types.TupleType:
+            if state[0] == 'V0':
+                self.__dict__.update(state[1])
+            else:
+                raise MixError("Unrecognized state version %s" % state[0])
         else:
-            raise MixError("Unrecognized state version %s" % state[0])
+            raise MixError("Unrecognized state type %s"% type(state))
+
 
     def isDelivery(self):
         """Return true iff this packet is a delivery (non-relay) packet."""

Index: ServerConfig.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerConfig.py,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- ServerConfig.py	7 Feb 2004 06:56:45 -0000	1.51
+++ ServerConfig.py	6 Mar 2004 00:04:38 -0000	1.52
@@ -359,7 +359,8 @@
                                             "10 minutes",) },
         # FFFF Generic multi-port listen/publish options.
         'Incoming/MMTP' : { 'Enabled' : ('REQUIRE', "boolean", "no"),
-                            #XXXX007/8 deprecate or remove IP.
+                            #XXXX008 deprecate or remove IP: hasn't been
+                            #XXXX008 needed since 0.0.5.
                             'IP' : ('ALLOW', "IP", "0.0.0.0"),
                           'Hostname' : ('ALLOW', "host", None),
                           'Port' : ('ALLOW', "int", "48099"),

Index: ServerKeys.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerKeys.py,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- ServerKeys.py	27 Jan 2004 05:15:38 -0000	1.65
+++ ServerKeys.py	6 Mar 2004 00:04:38 -0000	1.66
@@ -969,7 +969,7 @@
     mmtpProtocolsIn = ",".join(mmtpProtocolsIn)
     mmtpProtocolsOut = ",".join(mmtpProtocolsOut)
 
-    #XXXX007 remove
+    #XXXX008 remove: hasn't been needed since 0.0.5.
     identityKeyID = formatBase64(
                       mixminion.Crypto.sha1(
                           mixminion.Crypto.pk_encode_public_key(identityKey)))
@@ -996,7 +996,7 @@
         }
 
     # If we don't know our IP address, try to guess
-    if fields['IP'] == '0.0.0.0': #XXXX007 remove
+    if fields['IP'] == '0.0.0.0': #XXXX008 remove; not needed since 005.
         try:
             fields['IP'] = _guessLocalIP()
             LOG.warn("No IP configured; guessing %s",fields['IP'])

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- ServerMain.py	1 Mar 2004 06:54:54 -0000	1.119
+++ ServerMain.py	6 Mar 2004 00:04:38 -0000	1.120
@@ -441,7 +441,7 @@
                         fnames.extend(more)
                 except QueueEmpty:
                     pass
-                   
+
                 delNames = []
                 for fn in fnames:
                     if os.path.exists(fn):
@@ -670,17 +670,6 @@
             writeFile(os.path.join(homeDir, "version"),
                       SERVER_HOMEDIR_VERSION, 0644)
 
-        # Obsolete lock file.
-        #XXXX007: remove this check.
-        lockFname = os.path.join(homeDir, "lock")
-        if os.path.exists(lockFname):
-            lf = Lockfile(lockFname)
-            try:
-                lf.acquire()
-                lf.release()
-            except LockfileLocked:
-                raise UIError("Another (older) server seems to be running")
-
         # The pid/lock file.
         self.pidFile = config.getPidFile()
         if not os.path.exists(os.path.split(self.pidFile)[0]):
@@ -1106,7 +1095,7 @@
         _ECHO_OPT = 1
     elif _QUIET_OPT:
         # Don't even say we're silencing the log.
-        mixminion.Common.LOG.silenceNoted = 1 
+        mixminion.Common.LOG.silenceNoted = 1
         config['Server']['EchoMessages'] = 0
     if forceDaemon is not None:
         config['Server']['Daemon'] = forceDaemon

Index: ServerQueue.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerQueue.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- ServerQueue.py	28 Nov 2003 04:14:05 -0000	1.37
+++ ServerQueue.py	6 Mar 2004 00:04:38 -0000	1.38
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson.  See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson.  See LICENSE for licensing information.
 # $Id$
 
 """mixminion.server.ServerQueue
@@ -84,13 +84,6 @@
             self.queuedTime = state[1]
             self.lastAttempt = state[2]
             self.address = state[3]
-        elif state[0] == "V0":
-            #XXXX007 remove this case.
-            # 0.0.4 used a format that didn't have an 'address' field.
-            LOG.warn("Encountered an ancient queued message format.")
-            self.queuedTime = state[1]
-            self.lastAttempt = state[2]
-            self.address = None
         else:
             raise MixFatalError("Unrecognized delivery state")