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

[minion-cvs] We need to spawn threads and set sighandlers _after_ we...



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

Modified Files:
	ServerMain.py 
Log Message:
We need to spawn threads and set sighandlers _after_ we fork for daemon mode

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- ServerMain.py	9 Jan 2003 06:28:58 -0000	1.27
+++ ServerMain.py	9 Jan 2003 06:53:22 -0000	1.28
@@ -238,7 +238,7 @@
             self.deleteFile(f)
 
     def shutdown(self):
-        LOG.info("Telling cleanup thread to shut down") #????info
+        LOG.info("Telling cleanup thread to shut down.")
         self._queue.put(None)
 
     def run(self):
@@ -326,9 +326,6 @@
         """Create a new server from a ServerConfig."""
         LOG.debug("Initializing server")
 
-        installSIGCHLDHandler()
-        installSignalHandlers()
-        
         self.config = config
         homeDir = config['Server']['Homedir']
         createPrivateDir(homeDir)
@@ -396,6 +393,7 @@
         self.mmtpServer.connectQueues(incoming=self.incomingQueue,
                                       outgoing=self.outgoingQueue)
 
+
         self.cleaningThread = CleaningThread()
         self.cleaningThread.start()
         self.processingThread = PacketProcessingThread(self.incomingQueue)
@@ -620,10 +618,6 @@
     try:
         mixminion.Common.LOG.configure(config)
         LOG.debug("Configuring server")
-        mixminion.Common.configureShredCommand(config)
-        mixminion.Crypto.init_crypto(config)
-
-        server = MixminionServer(config)
     except:
         info = sys.exc_info()
         LOG.fatal_exc(info,"Exception while configuring server")
@@ -640,6 +634,20 @@
                           "Exception while starting server in the background")
             os._exit(0)
 
+    installSIGCHLDHandler()
+    installSignalHandlers()
+
+    try:
+        mixminion.Common.configureShredCommand(config)
+        mixminion.Crypto.init_crypto(config)
+
+        server = MixminionServer(config)
+    except:
+        info = sys.exc_info()
+        LOG.fatal_exc(info,"Exception while configuring server")
+        print >>sys.stderr, "Shutting down because of exception: %s"%info[1]
+        sys.exit(1)            
+            
     LOG.info("Starting server")
     try:
         server.run()