From da7d11493467dd29a40e8b5719263c4780d8fbb3 Mon Sep 17 00:00:00 2001 From: Nathan Seidle Date: Thu, 19 Dec 2024 15:18:27 -0700 Subject: [PATCH] Assign incoming TCP connection to the tcpServerClient array. Fixes #506 --- Firmware/RTK_Everywhere/TcpServer.ino | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/RTK_Everywhere/TcpServer.ino b/Firmware/RTK_Everywhere/TcpServer.ino index 80cbbe93..6f518e61 100644 --- a/Firmware/RTK_Everywhere/TcpServer.ino +++ b/Firmware/RTK_Everywhere/TcpServer.ino @@ -440,18 +440,18 @@ void tcpServerUpdate() // Determine if the client data structure is in use if (!(tcpServerClientConnected & (1 << index))) { - NetworkClient client; + if(tcpServerClient[index] == nullptr) + tcpServerClient[index] = new NetworkClient; // Data structure not in use // Check for another TCP server client - client = tcpServer->accept(); + *tcpServerClient[index] = tcpServer->accept(); - // Done if no TCP server client found - if (!client) + // Exit if no TCP server client found + if (! *tcpServerClient[index]) break; // Start processing the new TCP server client connection - tcpServerClient[index] = new NetworkClient; tcpServerClientIpAddress[index] = tcpServerClient[index]->remoteIP(); tcpServerClientConnected = tcpServerClientConnected | (1 << index); tcpServerClientDataSent = tcpServerClientDataSent | (1 << index);