Skip to content

Commit 425a4fc

Browse files
committed
TCP Server: update timer after client write
1 parent 056309a commit 425a4fc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Firmware/RTK_Everywhere/TcpServer.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static const char * tcpServerName;
120120
static volatile uint8_t tcpServerClientConnected;
121121
static volatile uint8_t tcpServerClientDataSent;
122122
static volatile uint8_t tcpServerClientSendingData;
123-
static uint32_t tcpServerClientTimer[TCP_SERVER_MAX_CLIENTS];
123+
static volatile uint32_t tcpServerClientTimer[TCP_SERVER_MAX_CLIENTS];
124124
static volatile uint8_t tcpServerClientWriteError;
125125
static NetworkClient *tcpServerClient[TCP_SERVER_MAX_CLIENTS];
126126
static IPAddress tcpServerClientIpAddress[TCP_SERVER_MAX_CLIENTS];
@@ -168,9 +168,12 @@ int32_t tcpServerClientSendData(int index, uint8_t *data, uint16_t length)
168168
length = tcpServerClient[index]->write(data, length);
169169
if (length > 0)
170170
{
171-
// Update the data sent flag when data successfully sent
171+
// Update the data sent flag and timer when data successfully sent
172172
if (length > 0)
173+
{
173174
tcpServerClientDataSent = tcpServerClientDataSent | (1 << index);
175+
tcpServerClientTimer[index] = millis();
176+
}
174177
if ((settings.debugTcpServer || PERIODIC_DISPLAY(PD_TCP_SERVER_CLIENT_DATA)) && (!inMainMenu))
175178
systemPrintf("%s wrote %d bytes to %s\r\n",
176179
tcpServerName, length,

0 commit comments

Comments
 (0)