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

[minion-cvs] Patch to make DEBUG and TRACE more reasonable



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

Modified Files:
	MMTPServer.py Modules.py ServerMain.py 
Log Message:
Patch to make DEBUG and TRACE more reasonable

Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- MMTPServer.py	7 Jan 2003 05:33:39 -0000	1.11
+++ MMTPServer.py	7 Jan 2003 19:17:57 -0000	1.12
@@ -86,13 +86,13 @@
                 raise e
 
         for fd in readfds:
-            trace("Select got a read on fd %s",fd)
+            #trace("Select got a read on fd %s",fd)
             self.readers[fd].handleRead()
         for fd in writefds:
-            trace("Select got a write on fd %s", fd)
+            #trace("Select got a write on fd %s", fd)
             self.writers[fd].handleWrite()
         for fd in exfds:
-            trace("Select got an exception on fd %s", fd)
+            #trace("Select got an exception on fd %s", fd)
             if self.readers.has_key(fd): del self.readers[fd]
             if self.writers.has_key(fd): del self.writers[fd]
 
@@ -333,7 +333,7 @@
         # else we can deadlock on a connection from ourself to
         # ourself.
         if self.__con.shutdown() == 1: #may throw want*
-            trace("Got a 1 on shutdown (fd %s)", self.fd)
+            #trace("Got a 1 on shutdown (fd %s)", self.fd)
             self.__server.unregister(self)
             self.__state = None
             self.__sock.close()
@@ -342,7 +342,7 @@
 
         # If we don't get any response on shutdown, stop blocking; the other
         # side may be hostile, confused, or deadlocking.
-        trace("Got a 0 on shutdown (fd %s)", self.fd)
+        #trace("Got a 0 on shutdown (fd %s)", self.fd)
         # ???? Is 'wantread' always correct?
         # ???? Rather than waiting for a read, should we use a timer or
         # ????       something?
@@ -353,7 +353,7 @@
         while 1:
             r = self.__con.read(1024) #may throw want*
             if r == 0:
-                trace("read returned 0 (fd %s)", self.fd)
+                trace("read returned 0 -- shutting down (fd %s)", self.fd)
                 self.shutdown(err=0)
                 return
             else:

Index: Modules.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Modules.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- Modules.py	7 Jan 2003 05:33:07 -0000	1.18
+++ Modules.py	7 Jan 2003 19:17:57 -0000	1.19
@@ -857,7 +857,7 @@
 
     # FFFF We should leave the connection open if we're going to send many
     # FFFF messages in a row.
-    LOG.trace("Sending message via SMTP host %s to %s", server, toList)
+    LOG.debug("Sending message via SMTP host %s to %s", server, toList)
     con = smtplib.SMTP(server)
     try:
         con.sendmail(fromAddr, toList, message)

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ServerMain.py	7 Jan 2003 04:49:11 -0000	1.23
+++ ServerMain.py	7 Jan 2003 19:17:57 -0000	1.24
@@ -121,9 +121,13 @@
     def mix(self):
         """Get a batch of messages, and queue them for delivery as
            appropriate."""
+        if self.queue.count() == 0:
+            LOG.trace("No messages in the mix pool")
+            return
         handles = self.queue.getBatch()
-        LOG.debug("Mixing %s messages out of %s",
-                       len(handles), self.queue.count())
+        LOG.debug("%s messages in the mix pool; delivering %s.",
+                  self.queue.count(), len(handles)
+        
         for h in handles:
             tp, info = self.queue.getObject(h)
             if tp == 'EXIT':
@@ -237,41 +241,41 @@
             nKeys = ceilDiv(30*24*60*60, keylife)
             self.keyring.createKeys(nKeys)
 
-        LOG.trace("Initializing packet handler")
+        LOG.debug("Initializing packet handler")
         self.packetHandler = self.keyring.getPacketHandler()
-        LOG.trace("Initializing TLS context")
+        LOG.debug("Initializing TLS context")
         tlsContext = self.keyring.getTLSContext()
-        LOG.trace("Initializing MMTP server")
+        LOG.debug("Initializing MMTP server")
         self.mmtpServer = _MMTPServer(config, tlsContext)
 
         # FFFF Modulemanager should know about async so it can patch in if it
         # FFFF needs to.
-        LOG.trace("Initializing delivery module")
+        LOG.debug("Initializing delivery module")
         self.moduleManager = config.getModuleManager()
         self.moduleManager.configure(config)
 
         queueDir = os.path.join(homeDir, 'work', 'queues')
 
         incomingDir = os.path.join(queueDir, "incoming")
-        LOG.trace("Initializing incoming queue")
+        LOG.debug("Initializing incoming queue")
         self.incomingQueue = IncomingQueue(incomingDir, self.packetHandler)
-        LOG.trace("Found %d pending messages in incoming queue",
-                       self.incomingQueue.count())
+        LOG.debug("Found %d pending messages in incoming queue",
+                  self.incomingQueue.count())
 
         mixDir = os.path.join(queueDir, "mix")
 
         LOG.trace("Initializing Mix pool")
         self.mixPool = MixPool(config, mixDir)
-        LOG.trace("Found %d pending messages in Mix pool",
+        LOG.debug("Found %d pending messages in Mix pool",
                        self.mixPool.count())
 
         outgoingDir = os.path.join(queueDir, "outgoing")
-        LOG.trace("Initializing outgoing queue")
+        LOG.debug("Initializing outgoing queue")
         self.outgoingQueue = OutgoingQueue(outgoingDir)
-        LOG.trace("Found %d pending messages in outgoing queue",
+        LOG.debug("Found %d pending messages in outgoing queue",
                        self.outgoingQueue.count())
 
-        LOG.trace("Connecting queues")
+        LOG.debug("Connecting queues")
         self.incomingQueue.connectQueues(mixPool=self.mixPool)
         self.mixPool.connectQueues(outgoing=self.outgoingQueue,
                                    manager=self.moduleManager)
@@ -298,7 +302,7 @@
                                  "TIMEOUT") )
         nextMix = self.mixPool.getNextMixTime(now)
         scheduledEvents.append( (nextMix, "MIX") )
-        LOG.trace("Next mix at %s", formatTime(nextMix,1))
+        LOG.debug("First mix at %s", formatTime(nextMix,1))
         scheduledEvents.sort()
 
         # FFFF Support for automatic key rotation.
@@ -328,7 +332,7 @@
             del scheduledEvents[0]
 
             if event == 'TIMEOUT':
-                LOG.debug("Timing out old connections")
+                LOG.trace("Timing out old connections")
                 self.mmtpServer.tryTimeout(now)
                 insort(scheduledEvents,
                        (self.mmtpServer.getNextTimeoutTime(now), "TIMEOUT"))