[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Fix numerous bugs. Headers and delivery now work again...
Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv20770/lib/mixminion/server
Modified Files:
Modules.py PacketHandler.py ServerMain.py
Log Message:
Fix numerous bugs. Headers and delivery now work again; server-side fragment reassembly does not.
Index: Modules.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Modules.py,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- Modules.py 25 Aug 2003 21:05:34 -0000 1.51
+++ Modules.py 25 Aug 2003 23:44:30 -0000 1.52
@@ -186,22 +186,23 @@
def _deliverMessages(self, msgList):
for handle in msgList:
try:
+ dh = handle.getHandle() # display handle
EventStats.log.attemptedDelivery() #FFFF
packet = handle.getMessage()
result = self.module.processMessage(packet)
if result == DELIVER_OK:
- LOG.debug("Successfully delivered message MOD:%s", handle)
+ LOG.debug("Successfully delivered message MOD:%s", dh)
handle.succeeded()
EventStats.log.successfulDelivery() #FFFF
elif result == DELIVER_FAIL_RETRY:
LOG.debug("Unable to deliver message MOD:%s; will retry",
- handle)
+ dh)
handle.failed(1)
EventStats.log.failedDelivery() #FFFF
else:
assert result == DELIVER_FAIL_NORETRY
LOG.error("Unable to deliver message MOD:%s; giving up",
- handle)
+ dh)
handle.failed(0)
EventStats.log.unretriableDelivery() #FFFF
except:
@@ -271,7 +272,7 @@
# Fields
# syntax: extensions to the syntax configuration in Config.py
# modules: a list of DeliveryModule objects
- # enabled: a set of enabled DeliveryModule objects
+ # enabled: a set of enabled DeliveryModule names.
# nameToModule: Map from module name to module
# typeToModule: a map from delivery type to enabled deliverymodule.
# path: search path for python modules.
@@ -298,6 +299,7 @@
self.registerModule(DropModule())
self.registerModule(DirectSMTPModule())
self.registerModule(MixmasterSMTPModule())
+ self.registerModule(FragmentModule())
self._isConfigured = 0
self.thread = None
@@ -468,13 +470,14 @@
def close(self):
"""Release all resources held by all modules."""
- for module in self.enabled:
- module.close()
+ for module in self.enabled.keys():
+ self.nameToModule[module].close()
def sync(self):
"""Flush all state held by all modules to disk."""
- for module in self.enabled:
- module.sync()
+ for module in self.enabled.keys():
+ self.nameToModule[module].close()
+
#----------------------------------------------------------------------
class DropModule(DeliveryModule):
@@ -522,11 +525,13 @@
self.close()
return
self.maxMessageSize = sec['MaximumSize']
- self.maxInterval = sec['MaximumInterval']
+ self.maxInterval = sec['MaximumInterval'].getSeconds()
# How many packets could it take to encode a max-size message?
- fp = mixminion.Fragments.FragmentParams(self.maxMessageSize, 0)
+ fp = mixminion.Fragments.FragmentationParams(self.maxMessageSize, 0)
self.maxFragments = fp.nChunks * fp.n
self.manager = manager
+ manager.enableModule(self)
+
def getServerInfoBlock(self):
return """[Delivery/Fragmented]
Version: 0.1
@@ -555,7 +560,10 @@
self.pool = mixminion.Fragments.FragmentPool(self.directory)
def queueDeliveryMessage(self, packet, retry=0, lastAttempt=0):
- if not packet.isFragment():
+ if packet.isError():
+ LOG.warn("Dropping FRAGMENT packet with decoding error: %s",
+ packet.error)
+ elif not packet.isFragment():
LOG.warn("Dropping FRAGMENT packet with non-fragment payload.")
return
if packet.getAddress():
@@ -565,6 +573,9 @@
payload = packet.getDecodedPayload()
assert payload is not None
self.pool.addFragment(payload)
+
+ def cleanQueue(self, deleteFn=None):
+ self.pool.cleanQueue(deleteFn)
def sendReadyMessages(self):
self.pool.unchunkMessages()
Index: PacketHandler.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/PacketHandler.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- PacketHandler.py 25 Aug 2003 21:05:34 -0000 1.22
+++ PacketHandler.py 25 Aug 2003 23:44:30 -0000 1.23
@@ -273,7 +273,7 @@
"""Construct a new DeliveryPacket."""
assert 0 <= routingType <= 0xFFFF
assert len(applicationKey) == 16
- assert len(tag) == 20
+ #assert len(tag) == 20 #XXXX make tag system sane.
assert len(payload) == 28*1024
self.exitType = routingType
self.address = routingInfo
@@ -369,8 +369,9 @@
self.contents = Packet.parsePayload(message).getContents()
self.type = 'long'
self.headers = {}
- except MixError:
+ except MixError, e:
self.contents = message
+ self.error = str(e) #DOCDOC
self.type = 'err'
self.headers = {}
Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- ServerMain.py 25 Aug 2003 21:05:34 -0000 1.89
+++ ServerMain.py 25 Aug 2003 23:44:30 -0000 1.90
@@ -146,7 +146,7 @@
def queueMessage(self, msg):
"""Add a message for delivery"""
- h = mixminion.server.ServerQueue.Queue.queueMessage(self, msg)
+ h = mixminion.Filestore.StringStore.queueMessage(self, msg)
LOG.trace("Inserting message IN:%s into incoming queue", h)
assert h is not None
self.processingThread.addJob(
@@ -188,9 +188,10 @@
self.removeMessage(handle)
class MixPool:
- """Wraps a mixminion.server.Queue.*MixPool to send messages to an exit
- queue and a delivery queue. The files in the MixPool are instances
- of RelayedPacket or DeliveryPacket from PacketHandler.
+ """Wraps a mixminion.server.ServerQueue.*MixPool to send messages
+ to an exit queue and a delivery queue. The files in the
+ MixPool are instances of RelayedPacket or DeliveryPacket from
+ PacketHandler.
All methods on this class are invoked from the main thread.
"""