diff options
author | Christian Hammacher <bmasterc@gmail.com> | 2022-06-17 16:17:23 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-06-22 10:51:33 +0300 |
commit | fa652467b4fb227d704a771b0de12e6d3e1dd48e (patch) | |
tree | f69b8edfba30f1befde82a16828132bf545cc8c9 | |
parent | 4d2b41e9ab69ef139a98f422a2357d14e83b4420 (diff) |
Last bug fix for W5500
Fixed same bug as in the WiFi/LwIP socket implementations
-rw-r--r-- | src/Networking/W5500Ethernet/W5500Socket.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Networking/W5500Ethernet/W5500Socket.cpp b/src/Networking/W5500Ethernet/W5500Socket.cpp index 46901f2e..6e24850c 100644 --- a/src/Networking/W5500Ethernet/W5500Socket.cpp +++ b/src/Networking/W5500Ethernet/W5500Socket.cpp @@ -178,7 +178,15 @@ void W5500Socket::Poll() noexcept { MutexLocker lock(interface->interfaceMutex); - switch(getSn_SR(socketNum)) + uint8_t socketStatus = getSn_SR(socketNum); + if (socketStatus == SOCK_CLOSE_WAIT && state == SocketState::listening) + { + // We get here when only very little data had been transferred before the connection was closed again. + // In this case make sure a network responder has a chance to deal with the pending data + socketStatus = SOCK_ESTABLISHED; + } + + switch(socketStatus) { case SOCK_INIT: // Socket has been initialised but is not listening yet if (localPort != 0) // localPort for the FTP data socket is 0 until we have decided what port number to use |