@@ -119,6 +119,7 @@ static const char * tcpServerName;
119
119
// TCP server clients
120
120
static volatile uint8_t tcpServerClientConnected;
121
121
static volatile uint8_t tcpServerClientDataSent;
122
+ static volatile uint8_t tcpServerClientSendingData;
122
123
static uint32_t tcpServerClientTimer[TCP_SERVER_MAX_CLIENTS];
123
124
static volatile uint8_t tcpServerClientWriteError;
124
125
static NetworkClient *tcpServerClient[TCP_SERVER_MAX_CLIENTS];
@@ -295,7 +296,7 @@ int32_t tcpServerSendData(uint16_t dataHead)
295
296
tail = tcpServerClientTails[index];
296
297
297
298
// Determine if the client is connected
298
- if (!(tcpServerClientConnected & (1 << index)))
299
+ if ((tcpServerClientSendingData & (1 << index)) == 0 )
299
300
tail = dataHead;
300
301
else
301
302
{
@@ -437,6 +438,7 @@ void tcpServerClientUpdate(uint8_t index)
437
438
tcpServerClient[index]->write (confirmConnection, strlen (confirmConnection));
438
439
439
440
// Start sending RTCM
441
+ tcpServerClientSendingData = tcpServerClientSendingData | (1 << index);
440
442
tcpServerClientState[index] = TCP_SERVER_CLIENT_SENDING_DATA;
441
443
}
442
444
break ;
@@ -491,8 +493,11 @@ void tcpServerClientUpdate(uint8_t index)
491
493
if (tcpServerInCasterMode)
492
494
tcpServerClientState[index] = TCP_SERVER_CLIENT_WAIT_REQUEST;
493
495
else
496
+ {
494
497
// Make client online after any NTRIP injections so ring buffer can start outputting data to it
498
+ tcpServerClientSendingData = tcpServerClientSendingData | (1 << index);
495
499
tcpServerClientState[index] = TCP_SERVER_CLIENT_SENDING_DATA;
500
+ }
496
501
break ;
497
502
}
498
503
}
@@ -607,6 +612,9 @@ void tcpServerStopClient(int index)
607
612
bool connected;
608
613
bool dataSent;
609
614
615
+ // Stop sending data
616
+ tcpServerClientSendingData = tcpServerClientSendingData & ~(1 << index);
617
+
610
618
// Determine if a client was allocated
611
619
if (tcpServerClient[index])
612
620
{
0 commit comments