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

[minion-cvs] Fix bug on starting server for the first time; improve ...



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

Modified Files:
	ServerMain.py 
Log Message:
Fix bug on starting server for the first time; improve error messages

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- ServerMain.py	9 Jan 2003 06:53:22 -0000	1.28
+++ ServerMain.py	9 Jan 2003 17:44:00 -0000	1.29
@@ -43,7 +43,7 @@
     def __init__(self, location, packetHandler):
         """Create an IncomingQueue that stores its messages in <location>
            and processes them through <packetHandler>."""
-        mixminion.server.ServerQueue.Queue.__init__(self, location)
+        mixminion.server.ServerQueue.Queue.__init__(self, location, create=1)
         self.packetHandler = packetHandler
         self.mixPool = None
         self._queue = Queue.Queue()
@@ -81,13 +81,16 @@
                 self.mixPool.queueObject(res)
                 self.removeMessage(handle)
         except mixminion.Crypto.CryptoError, e:
-            LOG.warn("Invalid PK or misencrypted packet header: %s", e)
+            LOG.warn("Invalid PK or misencrypted packet header in message %s: %s",
+                     formatBase64(message[:8]), e)
             self.removeMessage(handle)
         except mixminion.Packet.ParseError, e:
-            LOG.warn("Malformed message dropped: %s", e)
+            LOG.warn("Malformed message %s dropped: %s",
+                     formatBase64(message[:8]), e)
             self.removeMessage(handle)
         except mixminion.server.PacketHandler.ContentError, e:
-            LOG.warn("Discarding bad packet: %s", e)
+            LOG.warn("Discarding bad packet %s: %s",
+                     formatBase64(message[:8]), e)
             self.removeMessage(handle)
         except:
             LOG.error_exc(sys.exc_info(),
@@ -276,6 +279,11 @@
                 LOG.info("Processing thread shutting down.")
                 return
             self.incomingQueue.deliverMessage(handle)
+            # XXXX debugging hack
+            if self.incomingQueue._queue.qsize() == 0:
+                n = self.incomingQueue.count(1)
+                if n != 0:
+                    LOG.trace("_queue was empty, but incoming queue had %s",n)
 
 
 STOPPING = 0
@@ -648,7 +656,7 @@
         print >>sys.stderr, "Shutting down because of exception: %s"%info[1]
         sys.exit(1)            
             
-    LOG.info("Starting server")
+    LOG.info("Starting server: Mixminion %s", mixminion.__version__)
     try:
         server.run()
     except KeyboardInterrupt: