mirror of
https://github.com/espressif/openthread.git
synced 2026-08-11 13:17:48 +00:00
Fix control flow issues. (#171)
This commit is contained in:
+2
-1
@@ -395,10 +395,10 @@ exit:
|
||||
void Interpreter::ProcessMasterKey(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
uint8_t keyLength;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
uint8_t keyLength;
|
||||
const uint8_t *key = otGetMasterKey(&keyLength);
|
||||
|
||||
for (int i = 0; i < keyLength; i++)
|
||||
@@ -410,6 +410,7 @@ void Interpreter::ProcessMasterKey(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
int8_t keyLength;
|
||||
uint8_t key[16];
|
||||
|
||||
VerifyOrExit((keyLength = Hex2Bin(argv[0], key, sizeof(key))) >= 0, error = kThreadError_Parse);
|
||||
|
||||
@@ -516,6 +516,8 @@ void Mac::TransmitDoneTask(bool aRxPending, ThreadError aError)
|
||||
mReceiveTimer.Stop();
|
||||
}
|
||||
|
||||
// fall through
|
||||
|
||||
case kStateActiveScan:
|
||||
case kStateTransmitBeacon:
|
||||
SentFrame(aError == kThreadError_None);
|
||||
|
||||
@@ -542,7 +542,6 @@ void AddressResolver::SendAddressQueryResponse(const ThreadTargetTlv &aTargetTlv
|
||||
|
||||
memset(&messageInfo, 0, sizeof(messageInfo));
|
||||
memcpy(&messageInfo.GetPeerAddr(), &aDestination, sizeof(messageInfo.GetPeerAddr()));
|
||||
messageInfo.mInterfaceId = messageInfo.mInterfaceId;
|
||||
messageInfo.mPeerPort = kCoapUdpPort;
|
||||
|
||||
SuccessOrExit(error = mSocket.SendTo(*message, messageInfo));
|
||||
|
||||
@@ -96,8 +96,7 @@ int MleRouter::AllocateRouterId(void)
|
||||
|
||||
// choose available router id at random
|
||||
uint8_t freeBit;
|
||||
// freeBit = otPlatRandomGet() % numAvailable;
|
||||
freeBit = 0;
|
||||
freeBit = otPlatRandomGet() % numAvailable;
|
||||
|
||||
// allocate router id
|
||||
for (int i = 0; i < kMaxRouterId; i++)
|
||||
|
||||
@@ -873,7 +873,7 @@ ThreadError Leader::AddBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorder
|
||||
PrefixTlv *dstPrefix;
|
||||
ContextTlv *dstContext;
|
||||
BorderRouterTlv *dstBorderRouter;
|
||||
uint8_t aContextId;
|
||||
int contextId;
|
||||
|
||||
if ((dstPrefix = FindPrefix(aPrefix.GetPrefix(), aPrefix.GetPrefixLength())) == NULL)
|
||||
{
|
||||
@@ -890,7 +890,7 @@ ThreadError Leader::AddBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorder
|
||||
{
|
||||
dstContext->SetCompress();
|
||||
}
|
||||
else if ((aContextId = AllocateContext()) >= 0)
|
||||
else if ((contextId = AllocateContext()) >= 0)
|
||||
{
|
||||
dstContext = reinterpret_cast<ContextTlv *>(dstPrefix->GetNext());
|
||||
Insert(reinterpret_cast<uint8_t *>(dstContext), sizeof(ContextTlv));
|
||||
@@ -898,7 +898,7 @@ ThreadError Leader::AddBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorder
|
||||
dstContext->Init();
|
||||
dstContext->SetStable();
|
||||
dstContext->SetCompress();
|
||||
dstContext->SetContextId(aContextId);
|
||||
dstContext->SetContextId(contextId);
|
||||
dstContext->SetContextLength(aPrefix.GetPrefixLength());
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user