[CalendarServer-changes] [1241] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 22 18:38:35 PST 2007


Revision: 1241
          http://trac.macosforge.org/projects/calendarserver/changeset/1241
Author:   wsanchez at apple.com
Date:     2007-02-22 18:38:35 -0800 (Thu, 22 Feb 2007)

Log Message:
-----------
InstancePort -> BindHTTPPorts
InstanceSSLPort -> BindSSLPorts

Allow server to bind to multiple ports.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/cluster.py
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/tap.py

Modified: CalendarServer/trunk/twistedcaldav/cluster.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/cluster.py	2007-02-23 01:54:32 UTC (rev 1240)
+++ CalendarServer/trunk/twistedcaldav/cluster.py	2007-02-23 02:38:35 UTC (rev 1241)
@@ -74,8 +74,8 @@
             '-f', self.configFile,
             '-o', 'ServerType=slave',
             '-o', 'BindAddresses=%s' % (','.join(self.interfaces),),
-            '-o', 'InstancePort=%s' % (self.port,),
-            '-o', 'InstanceSSLPort=%s' % (self.sslPort,),
+            '-o', 'BindHTTPPorts=%s' % (self.port,),
+            '-o', 'BindSSLPorts=%s' % (self.sslPort,),
             '-o', 'PIDFile=None',
             '-o', 'ErrorLogFile=None']
     

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2007-02-23 01:54:32 UTC (rev 1240)
+++ CalendarServer/trunk/twistedcaldav/config.py	2007-02-23 02:38:35 UTC (rev 1241)
@@ -41,9 +41,8 @@
     #    This configures the actual network address that the server binds to.
     #
     "BindAddresses": [],   # List of IP addresses to bind to [empty = all]
-    "InstancePort": 0,     # Port number to bind to for HTTP [0 = same as "Port"]
-    "InstanceSSLPort": 0,  # Port number to bind to for SSL [0 = same as "SSLPort"]
-    "ManholePort": 0,      # Port number to bind to for Twisted manhole (debugging) [0 = none]
+    "BindHTTPPorts": [],   # List of port numbers to bind to for HTTP [empty = same as "Port"]
+    "BindSSLPorts" : [],   # List of port numbers to bind to for SSL [empty = same as "SSLPort"]
 
     #
     # Data store
@@ -131,10 +130,11 @@
     #    for development, but shouldn't be needed by users.
     #
 
-    # Twistd
+    # Twisted
     "twistdLocation": "/usr/share/caldavd/bin/twistd",
+    "ManholePort": 0, # Port number to bind to for Twisted manhole (debugging) [0 = none]
 
-    # Python director
+    # Python Director
     "pydirLocation": "/usr/share/caldavd/bin/pydir++.py",
     "pydirConfig": "/etc/caldavd/pydir.xml",
 }

Modified: CalendarServer/trunk/twistedcaldav/tap.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/tap.py	2007-02-23 01:54:32 UTC (rev 1240)
+++ CalendarServer/trunk/twistedcaldav/tap.py	2007-02-23 02:38:35 UTC (rev 1241)
@@ -427,55 +427,49 @@
         service = CalDAVService(logObserver)
 
         if not config.BindAddresses:
-            config.BindAddresses = ['']
+            config.BindAddresses = [""]
 
         for bindAddress in config.BindAddresses:
             if not config.SSLOnly:
-                if config.InstancePort == 0:
-                    config.InstancePort = config.HTTPPort
-                log.msg("Adding server at %s:%s" % (
-                    bindAddress, config.InstancePort))
+                if not config.BindHTTPPorts:
+                    config.BindHTTPPorts = [config.HTTPPort]
+
+                for port in config.BindHTTPPorts:
+                    log.msg("Adding server at %s:%s" % (bindAddress, port))
                     
-                httpService = internet.TCPServer(int(config.InstancePort), channel,
-                                                 interface=bindAddress)
-                httpService.setServiceParent(service)
+                    httpService = internet.TCPServer(int(port), channel, interface=bindAddress)
+                    httpService.setServiceParent(service)
 
             if config.SSLEnable:
                 from twisted.internet.ssl import DefaultOpenSSLContextFactory
-                if config.InstanceSSLPort == 0:
-                    config.InstanceSSLPort = config.SSLPort
-                log.msg("Adding SSL server at %s:%s" % (
-                    bindAddress, config.InstanceSSLPort))
+                if not config.BindSSLPorts:
+                    config.BindSSLPorts = [config.SSLPort]
+
+                for port in config.BindSSLPorts:
+                    log.msg("Adding SSL server at %s:%s" % (bindAddress, port))
                 
-                httpsService = internet.SSLServer(
-                    int(config.InstanceSSLPort),
-                    channel,
-                    DefaultOpenSSLContextFactory(config.SSLPrivateKey,
-                                                 config.SSLCertificate),
-                    interface=bindAddress
+                    httpsService = internet.SSLServer(
+                        int(port), channel,
+                        DefaultOpenSSLContextFactory(config.SSLPrivateKey, config.SSLCertificate),
+                        interface=bindAddress
                     )
-                httpsService.setServiceParent(service)
+                    httpsService.setServiceParent(service)
             
         return service
 
-    makeService_slave = makeService_singleprocess
-
+    makeService_slave        = makeService_singleprocess
     makeService_multiprocess = makeService_multiprocess
+    makeService_master       = makeService_pydir
 
-    makeService_master = makeService_pydir
-
     def makeService(self, options):
         serverType = config.ServerType
         
-        serviceMethod = getattr(self, 'makeService_%s' % (serverType,), None)
+        serviceMethod = getattr(self, "makeService_%s" % (serverType,), None)
 
         if not serviceMethod:
             raise UsageError(
-                ("Unknown server type %s, please choose: singleprocess, "
-                 "multiprocess, master, slave" % (serverType,)))
-
+                "Unknown server type %s, please choose: singleprocess, "
+                "multiprocess, master, slave" % (serverType,)
+            )
         else:
             return serviceMethod(options)
-            
-
-                                

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070222/b931e868/attachment.html


More information about the calendarserver-changes mailing list