Fix TCP receive: path table update + interface naming + 10Mbps bitrate

- Fix path table insert bug: C++ map::insert() silently fails when key
  exists (unlike Python dict[key]=value). Changed to erase()+insert() so
  updated paths (e.g. local TCP replacing stale LoRa) actually take effect.
- Add name parameter to TcpInterface constructor to give each instance a
  unique identity hash, fixing map collision between backbone and local
  TCP server interfaces.
- Set TCP interface bitrate to 10 Mbps (was 500 bps) so Transport
  correctly prefers TCP paths over LoRa when both exist.
- Add PRG button hold >5s white screen indicator for config portal.
- Boundary mode cull_path_table: evict backbone paths first, preserving
  local paths needed for inbound routing.
This commit is contained in:
James L
2026-02-22 20:28:13 -05:00
parent a746937390
commit 1cbed7afdf
5 changed files with 59 additions and 23 deletions

View File

@@ -60,8 +60,9 @@ struct TcpClient {
class TcpInterface : public RNS::InterfaceImpl {
public:
TcpInterface(TcpIfMode mode, uint16_t port = TCP_IF_DEFAULT_PORT,
const char* target_host = nullptr, uint16_t target_port = 0)
: RNS::InterfaceImpl("TcpInterface"),
const char* target_host = nullptr, uint16_t target_port = 0,
const char* name = "TcpInterface")
: RNS::InterfaceImpl(name),
_mode(mode),
_port(port),
_target_port(target_port),
@@ -77,11 +78,11 @@ public:
_IN = true;
_OUT = true;
_HW_MTU = TCP_IF_HW_MTU;
// Report low bitrate + small announce_cap so that Transport
// rate-limits announce forwarding through this interface.
// Without this the backbone floods the ESP32 with announces.
// 500 bps ≈ LoRa-class throughput; announce_cap = 2% max bandwidth.
_bitrate = 500;
// TCP links are effectively 10 Mbps+. Setting a realistic
// bitrate lets Transport prefer TCP paths over LoRa when
// both exist for the same destination.
// announce_cap = 2% keeps backbone announce flooding in check.
_bitrate = 10000000;
_announce_cap = 2.0;
if (target_host != nullptr) {
strncpy(_target_host, target_host, sizeof(_target_host) - 1);