use NSPR if no proxy, OpenSSL with proxy

This commit is contained in:
David Rose 2002-11-08 20:24:50 +00:00
parent 350369ae57
commit 3acbd6c86f

View File

@ -39,7 +39,8 @@ class ClientRepository(DirectObject.DirectObject):
# This is a much better socket library, but it may be more # This is a much better socket library, but it may be more
# than you need for most applications; and the proxy support # than you need for most applications; and the proxy support
# is weak. # is weak.
self.connectHttp = base.config.GetBool('connect-http', 1) self.directConnectHttp = base.config.GetBool('direct-connect-http', 0)
self.proxyConnectHttp = base.config.GetBool('proxy-connect-http', 1)
self.bootedIndex = None self.bootedIndex = None
self.bootedText = None self.bootedText = None
@ -78,9 +79,18 @@ class ClientRepository(DirectObject.DirectObject):
the return status code giving reason for failure, if it is the return status code giving reason for failure, if it is
known. known.
""" """
if self.hasProxy:
self.connectHttp = self.proxyConnectHttp
self.notify.info("Using proxy: %s" % (self.proxy.cStr()))
else:
self.connectHttp = self.directConnectHttp
self.notify.info("Not connecting via proxy.");
self.bootedIndex = None self.bootedIndex = None
self.bootedText = None self.bootedText = None
if self.connectHttp: if self.connectHttp:
self.notify.info("Connecting via HTTP interface.")
ch = self.http.makeChannel(0) ch = self.http.makeChannel(0)
ch.beginConnectTo(serverURL) ch.beginConnectTo(serverURL)
ch.spawnTask(name = 'connect-to-server', ch.spawnTask(name = 'connect-to-server',
@ -88,6 +98,7 @@ class ClientRepository(DirectObject.DirectObject):
extraArgs = [ch, successCallback, successArgs, extraArgs = [ch, successCallback, successArgs,
failureCallback, failureArgs]) failureCallback, failureArgs])
else: else:
self.notify.info("Connecting directly via NSPR interface.")
self.qcm = QueuedConnectionManager() self.qcm = QueuedConnectionManager()
# A big old 20 second timeout. # A big old 20 second timeout.
gameServerTimeoutMs = base.config.GetInt("game-server-timeout-ms", gameServerTimeoutMs = base.config.GetInt("game-server-timeout-ms",