Document the methods of manager
This commit is contained in:
parent
6369ea75d8
commit
4bd86a725a
|
@ -55,6 +55,7 @@ class Manager(threading.Thread):
|
|||
|
||||
@staticmethod
|
||||
def clean_objects():
|
||||
"""Delete expired objects"""
|
||||
for vector in set(shared.objects):
|
||||
if not shared.objects[vector].is_valid():
|
||||
if shared.objects[vector].is_expired():
|
||||
|
@ -70,6 +71,7 @@ class Manager(threading.Thread):
|
|||
|
||||
@staticmethod
|
||||
def manage_connections():
|
||||
"""Keep number of open connections according to the app settings"""
|
||||
hosts = set()
|
||||
outgoing_connections = 0
|
||||
for c in shared.connections.copy():
|
||||
|
@ -201,6 +203,7 @@ class Manager(threading.Thread):
|
|||
|
||||
@staticmethod
|
||||
def pickle_objects():
|
||||
"""Save objects into a pickle file"""
|
||||
try:
|
||||
with open(
|
||||
os.path.join(shared.data_directory, 'objects.pickle'), 'bw'
|
||||
|
@ -213,6 +216,7 @@ class Manager(threading.Thread):
|
|||
|
||||
@staticmethod
|
||||
def pickle_nodes():
|
||||
"""Save nodes into pickle files"""
|
||||
if len(shared.node_pool) > 10000:
|
||||
shared.node_pool = set(random.sample(shared.node_pool, 10000))
|
||||
if len(shared.unchecked_node_pool) > 1000:
|
||||
|
@ -241,6 +245,7 @@ class Manager(threading.Thread):
|
|||
|
||||
@staticmethod
|
||||
def publish_i2p_destination():
|
||||
"""Send I2P destination object"""
|
||||
if shared.i2p_session_nick and not shared.i2p_transient:
|
||||
logging.info('Publishing our I2P destination')
|
||||
dest_pub_raw = base64.b64decode(
|
||||
|
|
Loading…
Reference in New Issue
Block a user