proxy flake8 fixes

This commit is contained in:
lakshyacis 2019-09-06 19:04:52 +05:30
parent fa6ef4f933
commit 253cec15c4
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
3 changed files with 46 additions and 34 deletions

View File

@ -1,3 +1,7 @@
"""
src/network/httpd.py
=======================
"""
import asyncore
import socket
@ -5,6 +9,7 @@ from tls import TLSHandshake
class HTTPRequestHandler(asyncore.dispatcher):
"""Handling HTTP request"""
response = """HTTP/1.0 200 OK\r
Date: Sun, 23 Oct 2016 18:02:00 GMT\r
Content-Type: text/html; charset=UTF-8\r
@ -63,9 +68,10 @@ Connection: close\r
class HTTPSRequestHandler(HTTPRequestHandler, TLSHandshake):
"""Handling HTTPS request"""
def __init__(self, sock):
if not hasattr(self, '_map'):
asyncore.dispatcher.__init__(self, sock)
asyncore.dispatcher.__init__(self, sock) # pylint: disable=non-parent-init-called
# self.tlsDone = False
TLSHandshake.__init__(
self,
@ -87,7 +93,6 @@ class HTTPSRequestHandler(HTTPRequestHandler, TLSHandshake):
def readable(self):
if self.tlsDone:
return HTTPRequestHandler.readable(self)
else:
return TLSHandshake.readable(self)
def handle_read(self):
@ -99,7 +104,6 @@ class HTTPSRequestHandler(HTTPRequestHandler, TLSHandshake):
def writable(self):
if self.tlsDone:
return HTTPRequestHandler.writable(self)
else:
return TLSHandshake.writable(self)
def handle_write(self):
@ -110,6 +114,7 @@ class HTTPSRequestHandler(HTTPRequestHandler, TLSHandshake):
class HTTPServer(asyncore.dispatcher):
"""Handling HTTP Server"""
port = 12345
def __init__(self):
@ -133,6 +138,7 @@ class HTTPServer(asyncore.dispatcher):
class HTTPSServer(HTTPServer):
"""Handling HTTPS Server"""
port = 12345
def __init__(self):

View File

@ -36,7 +36,7 @@ def handleExpiredDandelion(expired):
class InvThread(StoppableThread):
"""A thread to manage inventory"""
"""A thread to send inv annoucements."""
name = "InvBroadcaster"

View File

@ -1,3 +1,8 @@
"""
src/network/proxy.py
====================
"""
# pylint: disable=protected-access
import socket
import time
@ -106,6 +111,7 @@ class Proxy(AdvancedDispatcher):
self.destination = address
self.isOutbound = True
self.fullyEstablished = False
self.connectedAt = 0
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
if BMConfigParser().safeGetBoolean(
"bitmessagesettings", "socksauthentication"):