pylint cleanup

This commit is contained in:
Lex Berezhny 2018-09-20 13:29:09 -04:00
parent d76758bd1d
commit 89f4ec12e9

View file

@ -42,18 +42,24 @@ class StratumClientProtocol(LineOnlyReceiver):
self.transport.setTcpNoDelay(True)
self.transport.setTcpKeepAlive(True)
if hasattr(socket, "TCP_KEEPIDLE"):
self.transport.socket.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE,
120) # Seconds before sending keepalive probes
self.transport.socket.setsockopt(
socket.SOL_TCP, socket.TCP_KEEPIDLE, 120
# Seconds before sending keepalive probes
)
else:
log.debug("TCP_KEEPIDLE not available")
if hasattr(socket, "TCP_KEEPINTVL"):
self.transport.socket.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL,
1) # Interval in seconds between keepalive probes
self.transport.socket.setsockopt(
socket.SOL_TCP, socket.TCP_KEEPINTVL, 1
# Interval in seconds between keepalive probes
)
else:
log.debug("TCP_KEEPINTVL not available")
if hasattr(socket, "TCP_KEEPCNT"):
self.transport.socket.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT,
5) # Failed keepalive probles before declaring other end dead
self.transport.socket.setsockopt(
socket.SOL_TCP, socket.TCP_KEEPCNT, 5
# Failed keepalive probles before declaring other end dead
)
else:
log.debug("TCP_KEEPCNT not available")
@ -62,16 +68,6 @@ class StratumClientProtocol(LineOnlyReceiver):
# but there's really no better place in code to trigger this.
log.warning("Error setting up socket: %s", err)
self.request_id = 0
self.lookup_table = {}
self._connected.callback(True)
# Initiate connection session
self.session = {}
log.debug("Connected %s" % self.transport.getPeer().host)
def connectionLost(self, reason=None):
self.on_disconnected_controller.add(True)