diff --git a/torch_agent/torch_agent.py b/torch_agent/torch_agent.py index 415cbf5..831c185 100755 --- a/torch_agent/torch_agent.py +++ b/torch_agent/torch_agent.py @@ -32,7 +32,7 @@ def main(): config = configparser.ConfigParser() configuration_file_path = config_path + "torch.conf" - print("Reading configuration file at '%s'" % (configuration_file_path)) + print("Reading configuration file at '%s'" % configuration_file_path) config.read(configuration_file_path) tor_proxy_host = config['tor'].get('ProxyHost', fallback="127.0.0.1") @@ -76,12 +76,14 @@ def main(): print("Published payload!") pub_client.disconnect() - def on_disconnect(): + def on_disconnect(pub_client): print("Disconnected!") + pub_client.loop_stop() client = mqtt.Client() client.on_publish = on_publish client.on_disconnect = on_disconnect + client.loop_start() protocol = "mqtt"