Skip to content

Commit da7d114

Browse files
committed
Assign incoming TCP connection to the tcpServerClient array.
Fixes #506
1 parent ac4ba63 commit da7d114

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Firmware/RTK_Everywhere/TcpServer.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,18 +440,18 @@ void tcpServerUpdate()
440440
// Determine if the client data structure is in use
441441
if (!(tcpServerClientConnected & (1 << index)))
442442
{
443-
NetworkClient client;
443+
if(tcpServerClient[index] == nullptr)
444+
tcpServerClient[index] = new NetworkClient;
444445

445446
// Data structure not in use
446447
// Check for another TCP server client
447-
client = tcpServer->accept();
448+
*tcpServerClient[index] = tcpServer->accept();
448449

449-
// Done if no TCP server client found
450-
if (!client)
450+
// Exit if no TCP server client found
451+
if (! *tcpServerClient[index])
451452
break;
452453

453454
// Start processing the new TCP server client connection
454-
tcpServerClient[index] = new NetworkClient;
455455
tcpServerClientIpAddress[index] = tcpServerClient[index]->remoteIP();
456456
tcpServerClientConnected = tcpServerClientConnected | (1 << index);
457457
tcpServerClientDataSent = tcpServerClientDataSent | (1 << index);

0 commit comments

Comments
 (0)