Skip to content

Commit ea2bd0e

Browse files
emelianovMarco Fagiolini
andauthored
Uncomment the explicit stop() method call to allow sockets cleanups (#281)
This should allow w5xxx-based ethernet to clean up their sockets' states upon disconnection, preventing the server implementation to experience sockets starvation Co-authored-by: Marco Fagiolini <mfx@amdx.de>
1 parent 0bc538d commit ea2bd0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ModbusTCPTemplate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void ModbusTCPTemplate<SERVER, CLIENT>::cleanupConnections() {
454454
for (uint8_t i = 0; i < MODBUSIP_MAX_CLIENTS; i++) {
455455
if (tcpclient[i] && !tcpclient[i]->connected()) {
456456
//IPAddress ip = tcpclient[i]->remoteIP();
457-
//tcpclient[i]->stop();
457+
tcpclient[i]->stop();
458458
delete tcpclient[i];
459459
tcpclient[i] = nullptr;
460460
if (cbDisconnect && cbEnabled)
@@ -563,7 +563,7 @@ bool ModbusTCPTemplate<SERVER, CLIENT>::disconnect(IPAddress ip) {
563563
return false;
564564
int8_t p = getSlave(ip);
565565
if (p != -1) {
566-
//tcpclient[p]->stop();
566+
tcpclient[p]->stop();
567567
delete tcpclient[p];
568568
tcpclient[p] = nullptr;
569569
return true;

0 commit comments

Comments
 (0)