sys/net/telnet: automatically disconnect after period of inactivity #17897
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
gnrc_tcp
can't detect if a connection was lost (not closed), so terminate the connection after a period of inactivity to prevent losing the socket forever if we lose the connection.Testing procedure
I tested this with
examples/telnet_server
onsame54-xpro
where I can easily trigger a loss of network connection by disconnecting the ethernet cable.Make sure to set
CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS
to something lower than the default, otherwise you'll have to wait an additional 2 minutes forsock_tcp_disconnect()
to return.telnet fe80::fec2:3dff:fe23:22df%eno1
CONFIG_TELNET_AUTO_DISCONNECT_SEC
) and an additional ~10s (or whatever you have set forCONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS
)telnet fe80::fec2:3dff:fe23:22df%eno1
On
master
the new connection can not be established as the server is still connected to the stale socket.With this patch you can connect to the server again.
Issues/PRs references
work-around for #17896