mirror of
https://github.com/espressif/openthread.git
synced 2026-08-05 02:17:47 +00:00
[socket] add SockAddr::Clear() (#4315)
This commit is contained in:
committed by
Jonathan Hui
parent
57f5044c9a
commit
663b59eb57
@@ -202,7 +202,13 @@ public:
|
||||
* This constructor initializes the object.
|
||||
*
|
||||
*/
|
||||
SockAddr(void) { memset(this, 0, sizeof(*this)); }
|
||||
SockAddr(void) { Clear(); }
|
||||
|
||||
/**
|
||||
* This method clears the object (sets all fields to zero).
|
||||
*
|
||||
*/
|
||||
void Clear(void) { memset(this, 0, sizeof(*this)); }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the IPv6 address.
|
||||
|
||||
@@ -75,8 +75,8 @@ otError UdpSocket::Open(otUdpReceive aHandler, void *aContext)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
memset(&mSockName, 0, sizeof(mSockName));
|
||||
memset(&mPeerName, 0, sizeof(mPeerName));
|
||||
GetSockName().Clear();
|
||||
GetPeerName().Clear();
|
||||
mHandler = aHandler;
|
||||
mContext = aContext;
|
||||
|
||||
@@ -142,8 +142,8 @@ otError UdpSocket::Close(void)
|
||||
#endif
|
||||
|
||||
Get<Udp>().RemoveSocket(*this);
|
||||
memset(&mSockName, 0, sizeof(mSockName));
|
||||
memset(&mPeerName, 0, sizeof(mPeerName));
|
||||
GetSockName().Clear();
|
||||
GetPeerName().Clear();
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user