be more aggressive about trying to get around proxies, and reporting messages to user

This commit is contained in:
David Rose 2002-11-10 18:15:58 +00:00
parent 60a902af01
commit 6a46a94f3c

View File

@ -26,21 +26,26 @@ class ClientRepository(DirectObject.DirectObject):
self.parseDcFile(dcFileName) self.parseDcFile(dcFileName)
self.cache=CRCache.CRCache() self.cache=CRCache.CRCache()
# Set this true to establish a connection to the server using # Set this to 'http' to establish a connection to the server
# the HTTPClient interface, which ultimately uses the OpenSSL # using the HTTPClient interface, which ultimately uses the
# socket library (even though SSL is not involved). This is # OpenSSL socket library (even though SSL is not involved).
# not as robust a socket library as NSPR's, but the HTTPClient # This is not as robust a socket library as NSPR's, but the
# interface does a good job of negotiating the connection over # HTTPClient interface does a good job of negotiating the
# an HTTP proxy if one is in use. # connection over an HTTP proxy if one is in use.
# Set it false to use Panda's net interface # Set it to 'nspr' to use Panda's net interface
# (e.g. QueuedConnectionManager, etc.) to establish the # (e.g. QueuedConnectionManager, etc.) to establish the
# connection, which ultimately uses the NSPR socket library. # connection, which ultimately uses the NSPR socket library.
# 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.directConnectHttp = base.config.GetBool('direct-connect-http', 0)
self.proxyConnectHttp = base.config.GetBool('proxy-connect-http', 1) # Set it to 'default' to use the HTTPClient interface if a
# proxy is in place, but the NSPR interface if we don't have a
# proxy.
self.connectMethod = base.config.GetString('connect-method', 'default')
self.connectHttp = None
self.bootedIndex = None self.bootedIndex = None
self.bootedText = None self.bootedText = None
@ -81,11 +86,16 @@ class ClientRepository(DirectObject.DirectObject):
""" """
if self.hasProxy: if self.hasProxy:
self.connectHttp = self.proxyConnectHttp self.notify.info("Connecting to gameserver via proxy: %s" % (self.proxy.cStr()))
self.notify.info("Using proxy: %s" % (self.proxy.cStr()))
else: else:
self.connectHttp = self.directConnectHttp self.notify.info("Connecting to gameserver directly (no proxy).");
self.notify.info("Not connecting via proxy.");
if self.connectMethod == 'http':
self.connectHttp = 1
elif self.connectMethod == 'nspr':
self.connectHttp = 0
else:
self.connectHttp = self.hasProxy
self.bootedIndex = None self.bootedIndex = None
self.bootedText = None self.bootedText = None
@ -98,7 +108,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.notify.info("Connecting 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",