diff --git a/src/onionrcommands/daemonlaunch/__init__.py b/src/onionrcommands/daemonlaunch/__init__.py
index acb6728f..4a90ce3b 100755
--- a/src/onionrcommands/daemonlaunch/__init__.py
+++ b/src/onionrcommands/daemonlaunch/__init__.py
@@ -112,7 +112,6 @@ def daemon():
f"Onionr daemon is running under pid {os.getpid()}", terminal=True)
events.event('init', threaded=False)
events.event('daemon_start')
-
Thread(target=gossip.start_gossip_threads, daemon=True).start()
try:
diff --git a/src/onionrplugins/__init__.py b/src/onionrplugins/__init__.py
index d63e0a42..4849f39d 100755
--- a/src/onionrplugins/__init__.py
+++ b/src/onionrplugins/__init__.py
@@ -1,22 +1,22 @@
-'''
- Onionr - Private P2P Communication
+"""
+Onionr - Private P2P Communication.
- This file deals with management of modules/plugins.
-'''
-'''
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+.
-'''
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+"""
import os, re, importlib
import traceback
@@ -32,9 +32,9 @@ _instances = dict()
config.reload()
def reload(stop_event = True):
- '''
+ """
Reloads all the plugins
- '''
+ """
check()
@@ -93,9 +93,9 @@ def enable(name, start_event = True):
def disable(name, stop_event = True):
- '''
+ """
Disables a plugin
- '''
+ """
check()
@@ -111,9 +111,9 @@ def disable(name, stop_event = True):
stop(name)
def start(name):
- '''
+ """
Starts the plugin
- '''
+ """
check()
@@ -135,9 +135,9 @@ def start(name):
return None
def stop(name):
- '''
+ """
Stops the plugin
- '''
+ """
check()
@@ -183,12 +183,11 @@ def import_module_from_file(full_path_to_module):
return module
def get_plugin(name):
- '''
+ """
Returns the instance of a module
- '''
+ """
check()
-
if str(name).lower() in _instances:
return _instances[str(name).lower()]
else:
@@ -196,23 +195,23 @@ def get_plugin(name):
return get_plugin(name)
def get_plugins():
- '''
+ """
Returns a list of plugins (deprecated)
- '''
+ """
return _instances
def exists(name):
- '''
+ """
Return value indicates whether or not the plugin exists
- '''
+ """
return os.path.isdir(get_plugins_folder(str(name).lower()))
def get_enabled_plugins():
- '''
+ """
Returns a list of the enabled plugins
- '''
+ """
check()
config.reload()
@@ -220,16 +219,16 @@ def get_enabled_plugins():
return list(config.get('plugins.enabled', list()))
def is_enabled(name):
- '''
+ """
Return value indicates whether or not the plugin is enabled
- '''
+ """
return name in get_enabled_plugins()
def get_plugins_folder(name = None, absolute = True):
- '''
+ """
Returns the path to the plugins folder
- '''
+ """
path = ''
@@ -246,16 +245,16 @@ def get_plugins_folder(name = None, absolute = True):
return path + '/'
def get_plugin_data_folder(name, absolute = True):
- '''
+ """
Returns the location of a plugin's data folder
- '''
+ """
return get_plugins_folder(name, absolute)
def check():
- '''
+ """
Checks to make sure files exist
- '''
+ """
if not config.is_set('plugins'):
logger.debug('Generating plugin configuration data...')
diff --git a/src/onionrplugins/onionrevents.py b/src/onionrplugins/onionrevents.py
index 16f1f487..b8f723b6 100755
--- a/src/onionrplugins/onionrevents.py
+++ b/src/onionrplugins/onionrevents.py
@@ -40,11 +40,10 @@ def __event_caller(event_name, data = {}):
if plugin in disabled: continue
try:
call(plugins.get_plugin(plugin), event_name, data, get_pluginapi(data))
- except ModuleNotFoundError as e:
+ except ModuleNotFoundError as _:
logger.warn('Disabling nonexistant plugin "%s"...' % plugin, terminal=True)
plugins.disable(plugin, stop_event = False)
- except Exception as e:
-
+ except Exception as _:
logger.error('Event "%s" failed for plugin "%s".' % (event_name, plugin), terminal=True)
logger.error('\n' + traceback.format_exc(), terminal=True)
diff --git a/static-data/default-plugins/unixtransport/bootstrap.txt b/static-data/default-plugins/unixtransport/bootstrap.txt
index 66f498a4..31712af4 100644
--- a/static-data/default-plugins/unixtransport/bootstrap.txt
+++ b/static-data/default-plugins/unixtransport/bootstrap.txt
@@ -1 +1 @@
-/dev/shm/onionr442130151/gossip-server.sock
\ No newline at end of file
+/dev/shm/onionr3177415330/gossip-server.sock
\ No newline at end of file
diff --git a/static-data/default-plugins/unixtransport/main.py b/static-data/default-plugins/unixtransport/main.py
index 49fbbcc7..b100105f 100644
--- a/static-data/default-plugins/unixtransport/main.py
+++ b/static-data/default-plugins/unixtransport/main.py
@@ -25,8 +25,8 @@ sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
# import after path insert
from unixpeer import UnixPeer
-from bootstrap import on_bootstrap
-from announce import on_announce_rec
+from unixbootstrap import on_bootstrap
+from unixannounce import on_announce_rec
#from shutdown import on_shutdown_event
"""
@@ -57,7 +57,6 @@ def on_init(api, data=None):
logger.info(
f"Peers can connect to {gossip_server_socket_file}", terminal=True)
-
def on_get_our_transport(api, data=None):
callback_func = data['callback']
for_peer = data['peer']
@@ -65,9 +64,3 @@ def on_get_our_transport(api, data=None):
return
if data['peer'].__class__ == UnixPeer:
callback_func(for_peer, gossip_server_socket_file)
-
-
-def on_gossip_start(api, data: Set[Peer] = None):
- # We don't do gossip logic
- return
-
diff --git a/static-data/default-plugins/unixtransport/announce.py b/static-data/default-plugins/unixtransport/unixannounce.py
similarity index 100%
rename from static-data/default-plugins/unixtransport/announce.py
rename to static-data/default-plugins/unixtransport/unixannounce.py
diff --git a/static-data/default-plugins/unixtransport/bootstrap.py b/static-data/default-plugins/unixtransport/unixbootstrap.py
similarity index 98%
rename from static-data/default-plugins/unixtransport/bootstrap.py
rename to static-data/default-plugins/unixtransport/unixbootstrap.py
index a5c3b13e..29176117 100644
--- a/static-data/default-plugins/unixtransport/bootstrap.py
+++ b/static-data/default-plugins/unixtransport/unixbootstrap.py
@@ -34,8 +34,7 @@ def load_existing_peers(callback: Callable):
daemon=True).start()
-def on_bootstrap(api, data):
-
+def on_bootstrap(api, data=None):
callback_func = data['callback']
try:
diff --git a/static-data/default-plugins/unixtransport/unixpeer.py b/static-data/default-plugins/unixtransport/unixpeer.py
index d679abe8..2a788c61 100644
--- a/static-data/default-plugins/unixtransport/unixpeer.py
+++ b/static-data/default-plugins/unixtransport/unixpeer.py
@@ -12,7 +12,6 @@ class UnixPeer:
def get_socket(self, connect_timeout) -> socket:
-
s = socket(AF_UNIX, SOCK_STREAM)
#s.settimeout(connect_timeout)
s.connect(self.transport_address)