Move s and state into the base
This commit is contained in:
parent
82c4062325
commit
c6d0160001
|
@ -10,9 +10,8 @@ from .util import I2PThread, pub_from_priv
|
|||
|
||||
class I2PController(I2PThread):
|
||||
def __init__(self, state, host='127.0.0.1', port=7656, dest_priv=b''):
|
||||
super().__init__(name='I2P Controller')
|
||||
super().__init__(state, name='I2P Controller')
|
||||
|
||||
self.state = state
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.nick = b'MiNode_' + base64.b16encode(os.urandom(4)).lower()
|
||||
|
|
|
@ -9,14 +9,14 @@ class I2PDialer(I2PThread):
|
|||
def __init__(
|
||||
self, state, destination, nick, sam_host='127.0.0.1', sam_port=7656
|
||||
):
|
||||
self.state = state
|
||||
|
||||
self.sam_host = sam_host
|
||||
self.sam_port = sam_port
|
||||
|
||||
self.nick = nick
|
||||
self.destination = destination
|
||||
|
||||
super().__init__(name='I2P Dial to {}'.format(self.destination))
|
||||
super().__init__(state, name='I2P Dial to {}'.format(self.destination))
|
||||
|
||||
self.s = socket.create_connection((self.sam_host, self.sam_port))
|
||||
|
||||
|
|
|
@ -7,15 +7,12 @@ from .util import I2PThread
|
|||
|
||||
class I2PListener(I2PThread):
|
||||
def __init__(self, state, nick, host='127.0.0.1', port=7656):
|
||||
super().__init__(name='I2P Listener')
|
||||
super().__init__(state, name='I2P Listener')
|
||||
|
||||
self.state = state
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.nick = nick
|
||||
|
||||
self.s = None
|
||||
|
||||
self.version_reply = []
|
||||
|
||||
self.new_socket()
|
||||
|
|
|
@ -20,6 +20,11 @@ class I2PThread(threading.Thread):
|
|||
Abstract I2P thread with _receive_line() and _send() methods,
|
||||
reused in I2PDialer, I2PListener and I2PController
|
||||
"""
|
||||
def __init__(self, state, name=''):
|
||||
super().__init__(name=name)
|
||||
self.state = state
|
||||
self.s = None
|
||||
|
||||
def _receive_line(self):
|
||||
line = receive_line(self.s)
|
||||
# logging.debug('I2PListener <- %s', line)
|
||||
|
|
Loading…
Reference in New Issue
Block a user