@@ -101,6 +101,7 @@ static const char * tcpServerName;
101
101
// TCP server clients
102
102
static volatile uint8_t tcpServerClientConnected;
103
103
static volatile uint8_t tcpServerClientDataSent;
104
+ static uint32_t tcpServerClientTimer[TCP_SERVER_MAX_CLIENTS];
104
105
static volatile uint8_t tcpServerClientWriteError;
105
106
static NetworkClient *tcpServerClient[TCP_SERVER_MAX_CLIENTS];
106
107
static IPAddress tcpServerClientIpAddress[TCP_SERVER_MAX_CLIENTS];
@@ -335,8 +336,8 @@ void tcpServerClientUpdate(uint8_t index)
335
336
// The client data structure is in use
336
337
// Check for a working TCP server client connection
337
338
clientConnected = tcpServerClient[index]->connected ();
338
- dataSent = ((millis () - tcpServerTimer ) < TCP_SERVER_CLIENT_DATA_TIMEOUT) ||
339
- (tcpServerClientDataSent & (1 << index));
339
+ dataSent = ((millis () - tcpServerClientTimer[index] ) < TCP_SERVER_CLIENT_DATA_TIMEOUT)
340
+ || (tcpServerClientDataSent & (1 << index));
340
341
if ((clientConnected && dataSent) == false )
341
342
{
342
343
// Broken connection, shutdown the TCP server client link
@@ -419,6 +420,9 @@ void tcpServerClientUpdate(uint8_t index)
419
420
}
420
421
} // tcpServerInCasterMode
421
422
423
+ // Start the data timer
424
+ tcpServerClientTimer[index] = millis ();
425
+
422
426
// Make client online after any NTRIP injections so ring buffer can start outputting data to it
423
427
tcpServerClientConnected = tcpServerClientConnected | (1 << index);
424
428
tcpServerClientDataSent = tcpServerClientDataSent | (1 << index);
@@ -546,7 +550,7 @@ void tcpServerStopClient(int index)
546
550
// Determine the shutdown reason
547
551
connected = tcpServerClient[index]->connected ()
548
552
&& (!(tcpServerClientWriteError & (1 << index)));
549
- dataSent = ((millis () - tcpServerTimer ) < TCP_SERVER_CLIENT_DATA_TIMEOUT)
553
+ dataSent = ((millis () - tcpServerClientTimer[index] ) < TCP_SERVER_CLIENT_DATA_TIMEOUT)
550
554
|| (tcpServerClientDataSent & (1 << index));
551
555
if (!dataSent)
552
556
systemPrintf (" %s: No data sent over %d seconds\r\n " ,
0 commit comments