[mac] scope timeIeOffset variable to block it is being used (#4369)

This commit is contained in:
Abtin Keshavarzian
2019-12-03 06:38:02 +08:00
committed by Jonathan Hui
parent bec7fb0563
commit e4fe479baf
+11 -11
View File
@@ -954,9 +954,6 @@ void Mac::BeginTransmit(void)
bool applyTransmitSecurity = true;
bool processTransmitAesCcm = true;
TxFrame &sendFrame = mSubMac.GetTransmitFrame();
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
uint8_t timeIeOffset = 0;
#endif
VerifyOrExit(mEnabled, error = OT_ERROR_ABORT);
@@ -1021,15 +1018,18 @@ void Mac::BeginTransmit(void)
}
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
timeIeOffset = GetTimeIeOffset(sendFrame);
sendFrame.SetTimeIeOffset(timeIeOffset);
if (timeIeOffset != 0)
{
// Transmit security will be processed after time IE content is updated.
processTransmitAesCcm = false;
sendFrame.SetTimeSyncSeq(Get<TimeSync>().GetTimeSyncSeq());
sendFrame.SetNetworkTimeOffset(Get<TimeSync>().GetNetworkTimeOffset());
uint8_t timeIeOffset = GetTimeIeOffset(sendFrame);
sendFrame.SetTimeIeOffset(timeIeOffset);
if (timeIeOffset != 0)
{
// Transmit security will be processed after time IE content is updated.
processTransmitAesCcm = false;
sendFrame.SetTimeSyncSeq(Get<TimeSync>().GetTimeSyncSeq());
sendFrame.SetNetworkTimeOffset(Get<TimeSync>().GetNetworkTimeOffset());
}
}
#endif