diff --git a/tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino index 0d5545769..ee1df80a7 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino @@ -63,7 +63,16 @@ void TCPLoop(void) if ((server_tcp) && (server_tcp->hasClient())) { WiFiClient new_client = server_tcp->available(); - AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Got connection from %s"), new_client.remoteIP().toString().c_str()); + // count already connected ports + uint32_t connected = 0; + for (uint32_t i=0; i= nitems(client_tcp)) { i = client_next++ % nitems(client_tcp); WiFiClient &client = client_tcp[i]; - client.stop(); + if (client.connected()) { + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_TCP "Replacing connection in slot %i, closing connection from %s"), i, client.remoteIP().toString().c_str()); + client.stop(); + } client = new_client; } }