kopia lustrzana https://github.com/glidernet/python-ogn-client
configurable socket timeout
rodzic
9240e4e990
commit
a855bab2d6
|
@ -24,14 +24,14 @@ class AprsClient:
|
||||||
self._sock_peer_ip = None
|
self._sock_peer_ip = None
|
||||||
self._kill = False
|
self._kill = False
|
||||||
|
|
||||||
def connect(self, retries=1, wait_period=15):
|
def connect(self, retries=1, wait_period=15, socket_timeout=5):
|
||||||
# create socket, connect to server, login and make a file object associated with the socket
|
# create socket, connect to server, login and make a file object associated with the socket
|
||||||
while retries > 0:
|
while retries > 0:
|
||||||
retries -= 1
|
retries -= 1
|
||||||
try:
|
try:
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||||
self.sock.settimeout(5)
|
self.sock.settimeout(socket_timeout)
|
||||||
|
|
||||||
if self.aprs_filter:
|
if self.aprs_filter:
|
||||||
port = self.settings.APRS_SERVER_PORT_CLIENT_DEFINED_FILTERS
|
port = self.settings.APRS_SERVER_PORT_CLIENT_DEFINED_FILTERS
|
||||||
|
|
Ładowanie…
Reference in New Issue