Revision: 1583 http://trac.macosforge.org/projects/calendarserver/changeset/1583 Author: dreid@apple.com Date: 2007-06-05 10:44:55 -0700 (Tue, 05 Jun 2007) Log Message: ----------- Document that we use 0 to mean HTTP or SSL is disabled. Check for that properly in tap.py so that we don't listen on 0 (which is a valid port just not really useful behaviour in this situation.) Do various other things more correctly when SSL gets turned off. 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-06-01 18:29:37 UTC (rev 1582) +++ CalendarServer/trunk/twistedcaldav/cluster.py 2007-06-05 17:44:55 UTC (rev 1583) @@ -85,19 +85,31 @@ if config.GroupName: args.extend(('-g', config.GroupName)) + import pdb; pdb.set_trace() + args.extend( ['-n', self.tapname, '-f', self.configFile, '-o', 'ProcessType=Slave', '-o', 'BindAddresses=%s' % (','.join(self.interfaces),), - '-o', 'BindHTTPPorts=%s' % (','.join(map(str, self.ports)),), - '-o', 'BindSSLPorts=%s' % (','.join(map(str, self.sslPorts)),), '-o', 'PIDFile=None', '-o', 'ErrorLogFile=None', '-o', 'MultiProcess/ProcessCount=%d' % ( config.MultiProcess['ProcessCount'],)]) + if self.ports: + args.extend([ + '-o', + 'BindHTTPPorts=%s' % (','.join(map(str, self.ports)),)]) + if self.sslPorts: + args.extend([ + '-o', + 'BindSSLPorts=%s' % (','.join(map(str, self.sslPorts)),)]) + + + + return args def getHostLine(self, ssl=None): @@ -156,6 +168,12 @@ if config.BindSSLPorts: sslPort = config.BindSSLPorts + if port[0] == 0: + port = None + + if sslPort[0] == 0: + sslPort = None + # If the load balancer isn't enabled, or if we only have one process # We listen directly on the interfaces. @@ -165,9 +183,12 @@ for p in xrange(0, config.MultiProcess['ProcessCount']): if config.MultiProcess['ProcessCount'] > 1: - port = [port[0] + 1] - sslPort = [sslPort[0] + 1] + if port is not None: + port = [port[0] + 1] + if sslPort is not None: + sslPort = [sslPort[0] + 1] + process = TwistdSlaveProcess(config.Twisted['twistd'], self.tapname, options['config'], @@ -205,11 +226,13 @@ httpPorts = config.BindHTTPPorts if not httpPorts: - httpPorts = (config.HTTPPort,) + if config.HTTPPort != 0: + httpPorts = (config.HTTPPort,) sslPorts = config.BindSSLPorts if not sslPorts: - sslPorts = (config.SSLPort,) + if config.SSLPort != 0: + sslPorts = (config.SSLPort,) for ports, listeners in ((httpPorts, httpListeners), (sslPorts, sslListeners)): Modified: CalendarServer/trunk/twistedcaldav/config.py =================================================================== --- CalendarServer/trunk/twistedcaldav/config.py 2007-06-01 18:29:37 UTC (rev 1582) +++ CalendarServer/trunk/twistedcaldav/config.py 2007-06-05 17:44:55 UTC (rev 1583) @@ -46,8 +46,8 @@ # proxy which forwards connections to the server. # "ServerHostName": "localhost", # Network host name. - "HTTPPort": -1, # HTTP port (None to disable HTTP) - "SSLPort" : -1, # SSL port (None to disable HTTPS) + "HTTPPort": 0, # HTTP port (0 to disable HTTP) + "SSLPort" : 0, # SSL port (0 to disable HTTPS) # Note: we'd use None above, but that confuses the command-line parser. Modified: CalendarServer/trunk/twistedcaldav/tap.py =================================================================== --- CalendarServer/trunk/twistedcaldav/tap.py 2007-06-01 18:29:37 UTC (rev 1582) +++ CalendarServer/trunk/twistedcaldav/tap.py 2007-06-05 17:44:55 UTC (rev 1583) @@ -520,15 +520,15 @@ for bindAddress in config.BindAddresses: if config.BindHTTPPorts: - if config.HTTPPort == -1: + if config.HTTPPort == 0: raise UsageError("HTTPPort required if BindHTTPPorts is not empty") - elif config.HTTPPort != -1: + elif config.HTTPPort != 0: config.BindHTTPPorts = [config.HTTPPort] if config.BindSSLPorts: - if config.SSLPort == -1: + if config.SSLPort == 0: raise UsageError("SSLPort required if BindSSLPorts is not empty") - elif config.SSLPort != -1: + elif config.SSLPort != 0: config.BindSSLPorts = [config.SSLPort] if config.BindSSLPorts:
participants (1)
-
source_changes@macosforge.org