mirror of
https://github.com/espressif/openthread.git
synced 2026-09-03 07:40:10 +00:00
[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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user