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
|
||||
|
||||
except ssl.SSLError as error:
|
||||
str_error = error.reason if error.reason else "Unknown error"
|
||||
except (ssl.SSLError, socket.error) as 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"
|
||||
": {error}").format(
|
||||
|
@ -250,7 +253,7 @@ def try_ssl_handshake(server):
|
|||
|
||||
server_buffer_prnt(
|
||||
server, ("{prefix}matrix: disconnecting from server..."
|
||||
).format(prefix=W.prefix("network")))
|
||||
).format(prefix=W.prefix("network")))
|
||||
|
||||
server.disconnect()
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue