[udp] clear all properties in SocketHandle from Udp::Open() (#10380)

This commit modifies `Udp::Open()` to clear all properties of the
passed-in `aSocket` using the `Clear()` method. This replaces the
existing code, which only cleared the socket and peer address and
port numbers. This change ensures that `void *mHandle` member
variable in `otUdpSocket` is also set to `nullptr` before invoking
platform UDP `otPlatUdpSocket()`.
This commit is contained in:
Abtin Keshavarzian
2024-06-14 10:00:58 -07:00
committed by GitHub
parent 3b589b3e1f
commit a98b60ef2e
+1 -2
View File
@@ -175,8 +175,7 @@ Error Udp::Open(SocketHandle &aSocket, otUdpReceive aHandler, void *aContext)
OT_ASSERT(!IsOpen(aSocket));
aSocket.GetSockName().Clear();
aSocket.GetPeerName().Clear();
aSocket.Clear();
aSocket.mHandler = aHandler;
aSocket.mContext = aContext;