[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Make server start and run. That"s usually good. [Bug 1...



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

Modified Files:
	DNSFarm.py MMTPServer.py ServerKeys.py ServerMain.py 
Log Message:
Make server start and run.  That's usually good. [Bug 15 and others]

DNSFarm:
- Fix typo; make server start

MMTPServer:
- Add missing import; change blocking queue fetch to nonblocking so
  that we don't block.

ServerKeys, ServerMain:
- Fix neat bug: If you shut down your server for a year and start it
  up again, the old code would generate a year's worth of intervening
  keys and immediately throw them out.  Not good; fixed.
- A similar bug would _regenerate_ descriptors for expired keys before
  removing them. Also fixed.
- Change "hostname is local" from error to warning.
 


Index: DNSFarm.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/DNSFarm.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- DNSFarm.py	19 Oct 2003 03:12:02 -0000	1.2
+++ DNSFarm.py	7 Nov 2003 08:11:36 -0000	1.3
@@ -79,7 +79,7 @@
                     del cache[name]
 
             # Remove dead threads from self.threads
-            self.threads = [ thr for thr in self.threads()
+            self.threads = [ thr for thr in self.threads
                              if thr.isLive() ]
 
             # Make sure we have enough threads.

Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- MMTPServer.py	19 Oct 2003 05:21:45 -0000	1.54
+++ MMTPServer.py	7 Nov 2003 08:11:36 -0000	1.55
@@ -32,7 +32,7 @@
 from mixminion.Crypto import sha1, getCommonPRNG
 from mixminion.Packet import MESSAGE_LEN, DIGEST_LEN, IPV4Info, MMTPHostInfo
 from mixminion.MMTPClient import PeerCertificateCache
-from mixminion.NetUtils import IN_PROGRESS_ERRNOS
+from mixminion.NetUtils import IN_PROGRESS_ERRNOS, getProtocolSupport
 import mixminion.server.EventStats as EventStats
 from mixminion.Filestore import CorruptedFile
 
@@ -1069,7 +1069,7 @@
         # FFFF Don't always listen; don't always retransmit!
         # FFFF Support listening on multiple IPs
 
-        ip4_supported, ip6_supported = mixminion.NetUtils.getProtocolSupport()
+        ip4_supported, ip6_supported = getProtocolSupport()
         IP, IP6 = None, None
         if ip4_supported:
             IP = config['Incoming/MMTP'].get('ListenIP')
@@ -1163,7 +1163,7 @@
         """DOCDOC"""
         while 1:
             try:
-                family,addr,port,keyID,deliverable=self.msgQueue.get(1)
+                family,addr,port,keyID,deliverable=self.msgQueue.get(block=0)
             except QueueEmpty:
                 return
             self.sendMessages(family,addr,port,keyID,deliverable)

Index: ServerKeys.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerKeys.py,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- ServerKeys.py	7 Nov 2003 07:30:37 -0000	1.55
+++ ServerKeys.py	7 Nov 2003 08:11:36 -0000	1.56
@@ -158,7 +158,7 @@
                   len(self.keySets), len(badKeySets))
 
         if badKeySets:
-            LOG.warn("Removing %s invalid keysets")
+            LOG.warn("Removing %s invalid keysets", len(badKeySets))
         for b in badKeySets:
             b.delete()
 
@@ -285,6 +285,8 @@
 
         if self.keySets:
             lastExpiry = self.keySets[-1][1]
+            if lastExpiry < now:
+                lastExpiry = now
         else:
             lastExpiry = now
 
@@ -308,6 +310,8 @@
         if startAt is None:
             if self.keySets:
                 startAt = self.keySets[-1][1]+60
+                if startAt < time.time():
+                    startAt = time.time()+60
             else:
                 startAt = time.time()+60
 
@@ -1185,12 +1189,12 @@
         for family, addr, _ in r:
             if family == mixminion.NetUtils.AF_INET:
                 if addr.startswith("127.") or addr.startswith("0."):
-                    raise UIError("Hostname %r resolves to reserved address %s"
-                                  %(name, addr))
+                    LOG.warn("Hostname %r resolves to reserved address %s",
+                             name, addr)
             else:
                 if addr in ("::", "::1"):
-                    raise UIError("Hostname %r resolves to reserved address %s"
-                                  %(name,addr))
+                    LOG.warn("Hostname %r resolves to reserved address %s",
+                             name,addr)
     except socket.error, e:
         raise UIError("Cannot resolve hostname %r: %s"%(name,e))
     _KNOWN_LOCAL_HOSTNAMES[name] = 1

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- ServerMain.py	20 Oct 2003 22:10:33 -0000	1.98
+++ ServerMain.py	7 Nov 2003 08:11:36 -0000	1.99
@@ -660,7 +660,8 @@
 may want to delete all your keysets with server-DELKEYS and have the server
 generate new ones.  [Messages sent to the old keys will be lost].\n
 The original error message was '%s'."""%e)
-            
+
+        self.keyring.removeDeadKeys()
         self.keyring.createKeysAsNeeded()
         self.keyring.checkDescriptorConsistency()