mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
Merge pull request #3881 from Prinzhorn/serverconnect
Only emit "serverconnect" after successfully connecting
This commit is contained in:
commit
49bc7d944a
@ -160,10 +160,10 @@ class ServerConnectionMixin:
|
|||||||
"""
|
"""
|
||||||
if not self.server_conn.address:
|
if not self.server_conn.address:
|
||||||
raise exceptions.ProtocolException("Cannot connect to server, no server address given.")
|
raise exceptions.ProtocolException("Cannot connect to server, no server address given.")
|
||||||
self.log("serverconnect", "debug", [repr(self.server_conn.address)])
|
|
||||||
self.channel.ask("serverconnect", self.server_conn)
|
|
||||||
try:
|
try:
|
||||||
self.server_conn.connect()
|
self.server_conn.connect()
|
||||||
|
self.log("serverconnect", "debug", [repr(self.server_conn.address)])
|
||||||
|
self.channel.ask("serverconnect", self.server_conn)
|
||||||
except exceptions.TcpException as e:
|
except exceptions.TcpException as e:
|
||||||
raise exceptions.ProtocolException(
|
raise exceptions.ProtocolException(
|
||||||
"Server connection to {} failed: {}".format(
|
"Server connection to {} failed: {}".format(
|
||||||
|
Loading…
Reference in New Issue
Block a user