Minor aesthetic fixes.

This commit is contained in:
Sandor Nemes 2016-01-18 09:55:46 +01:00
parent 192f033967
commit 918a457f5a
3 changed files with 5 additions and 7 deletions

View File

@ -89,8 +89,6 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
class ServerConnection(tcp.TCPClient, stateobject.StateObject): class ServerConnection(tcp.TCPClient, stateobject.StateObject):
def __init__(self, address, source_address=None): def __init__(self, address, source_address=None):
if source_address:
source_address = (source_address, 0)
tcp.TCPClient.__init__(self, address, source_address) tcp.TCPClient.__init__(self, address, source_address)
self.via = None self.via = None

View File

@ -109,9 +109,9 @@ class ServerConnectionMixin(object):
self.disconnect() self.disconnect()
""" """
def __init__(self, server_address=None, source_address=None): def __init__(self, server_address=None):
super(ServerConnectionMixin, self).__init__() super(ServerConnectionMixin, self).__init__()
self.server_conn = ServerConnection(server_address, source_address) self.server_conn = ServerConnection(server_address)
self.__check_self_connect() self.__check_self_connect()
def __check_self_connect(self): def __check_self_connect(self):
@ -157,7 +157,7 @@ class ServerConnectionMixin(object):
""" """
self.log("serverdisconnect", "debug", [repr(self.server_conn.address)]) self.log("serverdisconnect", "debug", [repr(self.server_conn.address)])
address = self.server_conn.address address = self.server_conn.address
source_address = self.server_conn.source_address()[0] source_address = self.server_conn.source_address
self.server_conn.finish() self.server_conn.finish()
self.server_conn.close() self.server_conn.close()
self.channel.tell("serverdisconnect", self.server_conn) self.channel.tell("serverdisconnect", self.server_conn)

View File

@ -46,7 +46,7 @@ class RequestReplayThread(threading.Thread):
# In all modes, we directly connect to the server displayed # In all modes, we directly connect to the server displayed
if self.config.mode == "upstream": if self.config.mode == "upstream":
server_address = self.config.upstream_server.address server_address = self.config.upstream_server.address
server = ServerConnection(server_address, self.config.host) server = ServerConnection(server_address, (self.config.host, 0))
server.connect() server.connect()
if r.scheme == "https": if r.scheme == "https":
connect_request = make_connect_request((r.host, r.port)) connect_request = make_connect_request((r.host, r.port))
@ -68,7 +68,7 @@ class RequestReplayThread(threading.Thread):
r.form_out = "absolute" r.form_out = "absolute"
else: else:
server_address = (r.host, r.port) server_address = (r.host, r.port)
server = ServerConnection(server_address, self.config.host) server = ServerConnection(server_address, (self.config.host, 0))
server.connect() server.connect()
if r.scheme == "https": if r.scheme == "https":
server.establish_ssl( server.establish_ssl(