mirror of
https://github.com/espressif/openthread.git
synced 2026-07-31 16:17:47 +00:00
[nexus] fix IPv6 receive callback setup in node reset (#12845)
This commit updates `Node::Reset()` in the Nexus platform to correctly set the IPv6 receive callback after the OpenThread `Instance` has been re-initialized via placement `new`. Previously, `otIp6SetReceiveCallback()` was called before the new `Instance` was constructed, meaning the callback registration would be lost when the instance memory was overwritten. Additionally, the callback registration now passes the associated `Node` object as the context.
This commit is contained in:
@@ -43,7 +43,6 @@ void Node::Reset(void)
|
||||
mInfraIf.mPendingTxQueue.DequeueAndFreeAll();
|
||||
mPendingTasklet = false;
|
||||
|
||||
otIp6SetReceiveCallback(&GetInstance(), HandleIp6Receive, &GetInstance());
|
||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
mTrel.Reset();
|
||||
#endif
|
||||
@@ -53,6 +52,8 @@ void Node::Reset(void)
|
||||
instance = new (instance) Instance();
|
||||
instance->SetId(id);
|
||||
instance->AfterInit();
|
||||
|
||||
otIp6SetReceiveCallback(instance, Node::HandleIp6Receive, this);
|
||||
}
|
||||
|
||||
void Node::Form(void)
|
||||
|
||||
Reference in New Issue
Block a user