mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 15:17:46 +00:00
[tcp] fix minor bugs (#7335)
This commit fixes minor bugs in TCP. 1. The first change fixes a bug where the TCP CLI prints out an incorrect message when a connection is terminated. This appears to have been introduced in #7279. 2. The second change fixes a null pointer dereference when accepting a TCP connection. This issue is purely theoretical at the moment, because in the case where the dereferenced pointer is NULL, the dereferenced value is not used, and so the compiler optimizes out the memory access (so it seems). As a result, TCP actually runs without issues. But I've fixed it anyway, to avoid depending on that behavior.
This commit is contained in:
+4
-4
@@ -450,10 +450,10 @@ void TcpExample::HandleTcpDisconnected(otTcpEndpoint *aEndpoint, otTcpDisconnect
|
||||
{
|
||||
static const char *const kReasonStrings[] = {
|
||||
"Disconnected", // (0) OT_TCP_DISCONNECTED_REASON_NORMAL
|
||||
"Entered TIME-WAIT state", // (1) OT_TCP_DISCONNECTED_REASON_REFUSED
|
||||
"Connection timed out", // (2) OT_TCP_DISCONNECTED_REASON_RESET
|
||||
"Connection refused", // (3) OT_TCP_DISCONNECTED_REASON_TIME_WAIT
|
||||
"Connection reset", // (4) OT_TCP_DISCONNECTED_REASON_TIMED_OUT
|
||||
"Connection refused", // (1) OT_TCP_DISCONNECTED_REASON_REFUSED
|
||||
"Connection reset", // (2) OT_TCP_DISCONNECTED_REASON_RESET
|
||||
"Entered TIME-WAIT state", // (3) OT_TCP_DISCONNECTED_REASON_TIME_WAIT
|
||||
"Connection timed out", // (4) OT_TCP_DISCONNECTED_REASON_TIMED_OUT
|
||||
};
|
||||
|
||||
OT_UNUSED_VARIABLE(aEndpoint);
|
||||
|
||||
Reference in New Issue
Block a user