1
0
mirror of https://github.com/azlux/pymumble synced 2024-11-27 07:34:21 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
ac3b6dee0c
minor version 2021-05-07 23:51:08 +02:00
4047e4ade5
Connection error when IP lookup fail
Merge pull request #105 from raek/pymumble_py3
2021-05-07 23:49:43 +02:00
Rasmus Bondesson
738b479bc0 Retry IP lookup errors the same way as connection errors
After this change, the retry loop no longer stops working if the IP
address could not be looked up. The same retry logic used for
connection failures is used.

IP address lookup failures can happen when the internet connection is
down. This change makes the pymumble client survive such outages.
2021-05-07 20:14:08 +02:00
2 changed files with 11 additions and 7 deletions

View File

@ -3,7 +3,7 @@
import platform
import sys
PYMUMBLE_VERSION = "1.6"
PYMUMBLE_VERSION = "1.6.1"
# ============================================================================
# Tunable parameters

View File

@ -144,13 +144,17 @@ class Mumble(threading.Thread):
def connect(self):
"""Connect to the server"""
# Get IPv4/IPv6 server address
server_info = socket.getaddrinfo(self.host, self.port, type=socket.SOCK_STREAM)
try:
# Get IPv4/IPv6 server address
server_info = socket.getaddrinfo(self.host, self.port, type=socket.SOCK_STREAM)
# Connect the SSL tunnel
self.Log.debug("connecting to %s (%s) on port %i.", self.host, server_info[0][1], self.port)
std_sock = socket.socket(server_info[0][0], socket.SOCK_STREAM)
std_sock.settimeout(10)
# Connect the SSL tunnel
self.Log.debug("connecting to %s (%s) on port %i.", self.host, server_info[0][1], self.port)
std_sock = socket.socket(server_info[0][0], socket.SOCK_STREAM)
std_sock.settimeout(10)
except socket.error:
self.connected = PYMUMBLE_CONN_STATE_FAILED
return self.connected
try:
self.control_socket = ssl.wrap_socket(std_sock, certfile=self.certfile, keyfile=self.keyfile, ssl_version=ssl.PROTOCOL_TLS)