mirror of
https://github.com/espressif/openthread.git
synced 2026-07-26 22:09:05 +00:00
[address-solicit] only allow one oustanding address solicit (#2229)
This commit is contained in:
@@ -76,6 +76,7 @@ MleRouter::MleRouter(ThreadNetif &aThreadNetif):
|
||||
mFixedLeaderPartitionId(0),
|
||||
mRouterRoleEnabled(true),
|
||||
mIsRouterRestoringChildren(false),
|
||||
mAddressSolicitPending(false),
|
||||
mPreviousPartitionId(0),
|
||||
mRouterSelectionJitter(kRouterSelectionJitter),
|
||||
mRouterSelectionJitterTimeout(0),
|
||||
@@ -3937,7 +3938,9 @@ otError MleRouter::SendAddressSolicit(ThreadStatusTlv::Status aStatus)
|
||||
ThreadRloc16Tlv rlocTlv;
|
||||
ThreadStatusTlv statusTlv;
|
||||
Ip6::MessageInfo messageInfo;
|
||||
Message *message;
|
||||
Message *message = NULL;
|
||||
|
||||
VerifyOrExit(mAddressSolicitPending == false);
|
||||
|
||||
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||
header.SetToken(Coap::Header::kDefaultTokenLength);
|
||||
@@ -3967,6 +3970,7 @@ otError MleRouter::SendAddressSolicit(ThreadStatusTlv::Status aStatus)
|
||||
|
||||
SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo,
|
||||
&MleRouter::HandleAddressSolicitResponse, this));
|
||||
mAddressSolicitPending = true;
|
||||
|
||||
LogMleMessage("Send Address Solicit", messageInfo.GetPeerAddr());
|
||||
|
||||
@@ -4034,7 +4038,6 @@ void MleRouter::HandleAddressSolicitResponse(void *aContext, otCoapHeader *aHead
|
||||
void MleRouter::HandleAddressSolicitResponse(Coap::Header *aHeader, Message *aMessage,
|
||||
const Ip6::MessageInfo *aMessageInfo, otError aResult)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aResult);
|
||||
OT_UNUSED_VARIABLE(aMessageInfo);
|
||||
|
||||
ThreadStatusTlv statusTlv;
|
||||
@@ -4044,6 +4047,8 @@ void MleRouter::HandleAddressSolicitResponse(Coap::Header *aHeader, Message *aMe
|
||||
Router *router;
|
||||
bool old;
|
||||
|
||||
mAddressSolicitPending = false;
|
||||
|
||||
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader != NULL && aMessage != NULL);
|
||||
|
||||
VerifyOrExit(aHeader->GetCode() == OT_COAP_CODE_CHANGED);
|
||||
|
||||
@@ -821,8 +821,9 @@ private:
|
||||
uint8_t mRouterDowngradeThreshold;
|
||||
uint8_t mLeaderWeight;
|
||||
uint32_t mFixedLeaderPartitionId; ///< only for certification testing
|
||||
bool mRouterRoleEnabled;
|
||||
bool mIsRouterRestoringChildren;
|
||||
bool mRouterRoleEnabled : 1;
|
||||
bool mIsRouterRestoringChildren : 1;
|
||||
bool mAddressSolicitPending : 1;
|
||||
|
||||
uint8_t mRouterId;
|
||||
uint8_t mPreviousRouterId;
|
||||
|
||||
Reference in New Issue
Block a user