[address-solicit] only allow one oustanding address solicit (#2229)

This commit is contained in:
Jonathan Hui
2017-10-10 08:43:18 -07:00
committed by GitHub
parent 41e498a71c
commit 95f744fbb4
2 changed files with 10 additions and 4 deletions
+7 -2
View File
@@ -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);
+3 -2
View File
@@ -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;