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

[minion-cvs] Refactor code that inforces spec w.r.t. drop payloads.



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

Modified Files:
	ClientMain.py BuildMessage.py 
Log Message:
Refactor code that inforces spec w.r.t. drop payloads.


Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- ClientMain.py	12 Jan 2003 04:25:27 -0000	1.42
+++ ClientMain.py	13 Jan 2003 06:13:33 -0000	1.43
@@ -835,12 +835,9 @@
 
         routingType, routingInfo, _ = address.getRouting()
         LOG.info("Generating payload...")
-        suppressTag = 0
-        if payload is None:
-            suppressTag = 1
         msg = mixminion.BuildMessage.buildForwardMessage(
             payload, routingType, routingInfo, servers1, servers2,
-            self.prng, suppressTag=suppressTag)
+            self.prng)
         return msg, servers1[0]
 
     def sendMessages(self, msgList, server):

Index: BuildMessage.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/BuildMessage.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- BuildMessage.py	12 Jan 2003 04:25:27 -0000	1.35
+++ BuildMessage.py	13 Jan 2003 06:13:33 -0000	1.36
@@ -20,7 +20,7 @@
            'buildReplyBlock', 'decodePayload' ]
 
 def buildForwardMessage(payload, exitType, exitInfo, path1, path2,
-                        paddingPRNG=None, suppressTag=0):
+                        paddingPRNG=None):
     """Construct a forward message.
             payload: The payload to deliver.  Must compress to under 28K-22b.
                   If it does not, MixError is raised.  If the payload is
@@ -41,6 +41,11 @@
     if not path2:
         raise MixError("Second leg of path is empty")
 
+    suppressTag = 0
+    if exitType == DROP_TYPE:
+        suppressTag = 1
+        payload = None
+
     # Compress, pad, and checksum the payload.
     if payload is not None:
         payload = _encodePayload(payload, 0, paddingPRNG)
@@ -606,7 +611,7 @@
     # FFFF - We should make this rule configurable.
     maxLen = max(20*1024, 20*len(contents))
 
-    return uncompressData(payload.getContents(), maxLength=maxLen)
+    return uncompressData(contents, maxLength=maxLen)
 
 def _checkPayload(payload):
     'Return true iff the hash on the given payload seems valid'