File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -452,18 +452,29 @@ void tcpServerClientUpdate(uint8_t index)
452
452
{
453
453
// Data structure not in use
454
454
if (tcpServerClient[index] == nullptr )
455
+ {
455
456
tcpServerClient[index] = new NetworkClient;
456
457
457
- // Check for another TCP server client
458
+ // Check for allocation failure
459
+ if (tcpServerClient[index] == nullptr )
460
+ {
461
+ if (settings.debugTcpServer )
462
+ Serial.printf (" ERROR: Failed to allocate %s client!\r\n " , tcpServerName);
463
+ break ;
464
+ }
465
+ }
466
+
467
+ // Check for another incoming TCP server client connection request
458
468
*tcpServerClient[index] = tcpServer->accept ();
459
469
460
470
// Exit if no TCP server client found
461
471
if (!*tcpServerClient[index])
462
472
break ;
463
473
464
- // TCP server client found
465
- // Start processing the new TCP server client connection
474
+ // Get the remote IP address
466
475
tcpServerClientIpAddress[index] = tcpServerClient[index]->remoteIP ();
476
+
477
+ // Display the connection
467
478
if ((settings.debugTcpServer || PERIODIC_DISPLAY (PD_TCP_SERVER_DATA)) && (!inMainMenu))
468
479
systemPrintf (" %s client %d connected to %s\r\n " ,
469
480
tcpServerName, index,
You can’t perform that action at this time.
0 commit comments