From 0bc3d392cf131f11d809b2b0a4ff55105e3d7817 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 25 Jun 2025 07:30:46 -0700 Subject: [PATCH] fix Interface logic a condition where TCP interfaces can fail leaving a none condition. this should resolve the errored interface better. --- mesh_bot.py | 19 +++++++++---------- pong_bot.py | 18 +++++++++--------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 75a9618..b14ccd8 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -1107,16 +1107,15 @@ def onReceive(packet, interface): if rxType == 'TCPInterface': rxHost = interface.__dict__.get('hostname', 'unknown') - if hostname1 in rxHost and interface1_type == 'tcp': rxNode = 1 - elif multiple_interface and hostname2 in rxHost and interface2_type == 'tcp': rxNode = 2 - elif multiple_interface and hostname3 in rxHost and interface3_type == 'tcp': rxNode = 3 - elif multiple_interface and hostname4 in rxHost and interface4_type == 'tcp': rxNode = 4 - elif multiple_interface and hostname5 in rxHost and interface5_type == 'tcp': rxNode = 5 - elif multiple_interface and hostname6 in rxHost and interface6_type == 'tcp': rxNode = 6 - elif multiple_interface and hostname7 in rxHost and interface7_type == 'tcp': rxNode = 7 - elif multiple_interface and hostname8 in rxHost and interface8_type == 'tcp': rxNode = 8 - elif multiple_interface and hostname9 in rxHost and interface9_type == 'tcp': rxNode = 9 - + if rxHost and hostname1 in rxHost and interface1_type == 'tcp': rxNode = 1 + elif multiple_interface and rxHost and hostname2 in rxHost and interface2_type == 'tcp': rxNode = 2 + elif multiple_interface and rxHost and hostname3 in rxHost and interface3_type == 'tcp': rxNode = 3 + elif multiple_interface and rxHost and hostname4 in rxHost and interface4_type == 'tcp': rxNode = 4 + elif multiple_interface and rxHost and hostname5 in rxHost and interface5_type == 'tcp': rxNode = 5 + elif multiple_interface and rxHost and hostname6 in rxHost and interface6_type == 'tcp': rxNode = 6 + elif multiple_interface and rxHost and hostname7 in rxHost and interface7_type == 'tcp': rxNode = 7 + elif multiple_interface and rxHost and hostname8 in rxHost and interface8_type == 'tcp': rxNode = 8 + elif multiple_interface and rxHost and hostname9 in rxHost and interface9_type == 'tcp': rxNode = 9 if rxType == 'BLEInterface': if interface1_type == 'ble': rxNode = 1 elif multiple_interface and interface2_type == 'ble': rxNode = 2 diff --git a/pong_bot.py b/pong_bot.py index 29ddd5a..7eef81a 100755 --- a/pong_bot.py +++ b/pong_bot.py @@ -217,15 +217,15 @@ def onReceive(packet, interface): if rxType == 'TCPInterface': rxHost = interface.__dict__.get('hostname', 'unknown') - if hostname1 in rxHost and interface1_type == 'tcp': rxNode = 1 - elif multiple_interface and hostname2 in rxHost and interface2_type == 'tcp': rxNode = 2 - elif multiple_interface and hostname3 in rxHost and interface3_type == 'tcp': rxNode = 3 - elif multiple_interface and hostname4 in rxHost and interface4_type == 'tcp': rxNode = 4 - elif multiple_interface and hostname5 in rxHost and interface5_type == 'tcp': rxNode = 5 - elif multiple_interface and hostname6 in rxHost and interface6_type == 'tcp': rxNode = 6 - elif multiple_interface and hostname7 in rxHost and interface7_type == 'tcp': rxNode = 7 - elif multiple_interface and hostname8 in rxHost and interface8_type == 'tcp': rxNode = 8 - elif multiple_interface and hostname9 in rxHost and interface9_type == 'tcp': rxNode = 9 + if rxHost and hostname1 in rxHost and interface1_type == 'tcp': rxNode = 1 + elif multiple_interface and rxHost and hostname2 in rxHost and interface2_type == 'tcp': rxNode = 2 + elif multiple_interface and rxHost and hostname3 in rxHost and interface3_type == 'tcp': rxNode = 3 + elif multiple_interface and rxHost and hostname4 in rxHost and interface4_type == 'tcp': rxNode = 4 + elif multiple_interface and rxHost and hostname5 in rxHost and interface5_type == 'tcp': rxNode = 5 + elif multiple_interface and rxHost and hostname6 in rxHost and interface6_type == 'tcp': rxNode = 6 + elif multiple_interface and rxHost and hostname7 in rxHost and interface7_type == 'tcp': rxNode = 7 + elif multiple_interface and rxHost and hostname8 in rxHost and interface8_type == 'tcp': rxNode = 8 + elif multiple_interface and rxHost and hostname9 in rxHost and interface9_type == 'tcp': rxNode = 9 if rxType == 'BLEInterface': if interface1_type == 'ble': rxNode = 1