main: Handle socket errors during the SSL handshake.
This commit is contained in:
parent
9e6bd0c246
commit
35e6978622
1 changed files with 6 additions and 3 deletions
9
main.py
9
main.py
|
@ -239,8 +239,11 @@ def try_ssl_handshake(server):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
except ssl.SSLError as error:
|
except (ssl.SSLError, socket.error) as error:
|
||||||
str_error = error.reason if error.reason else "Unknown error"
|
try:
|
||||||
|
str_error = error.reason if error.reason else "Unknown error"
|
||||||
|
except AttributeError:
|
||||||
|
str_error = str(error)
|
||||||
|
|
||||||
message = ("{prefix}Error while doing SSL handshake"
|
message = ("{prefix}Error while doing SSL handshake"
|
||||||
": {error}").format(
|
": {error}").format(
|
||||||
|
@ -250,7 +253,7 @@ def try_ssl_handshake(server):
|
||||||
|
|
||||||
server_buffer_prnt(
|
server_buffer_prnt(
|
||||||
server, ("{prefix}matrix: disconnecting from server..."
|
server, ("{prefix}matrix: disconnecting from server..."
|
||||||
).format(prefix=W.prefix("network")))
|
).format(prefix=W.prefix("network")))
|
||||||
|
|
||||||
server.disconnect()
|
server.disconnect()
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Add table
Reference in a new issue