mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 07:07:47 +00:00
[time-sync] fix time sync and typo (#3637)
* fix typo in common-switches * fix segment fault with time sync enabled
This commit is contained in:
@@ -60,6 +60,7 @@ SNTP_CLIENT ?= 1
|
||||
UDP_FORWARD ?= 1
|
||||
|
||||
COMMONCFLAGS := \
|
||||
-g \
|
||||
$(NULL)
|
||||
|
||||
# If the user has asserted COVERAGE, alter the configuration options
|
||||
@@ -80,7 +81,6 @@ configure_OPTIONS = \
|
||||
ifneq ($(DEBUG),1)
|
||||
COMMONCFLAGS += \
|
||||
-O2 \
|
||||
-g \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ configure_OPTIONS += --enable-sntp-client
|
||||
endif
|
||||
|
||||
ifeq ($(TIME_SYNC),1)
|
||||
COMMONCFLAGS += -DPENTHREAD_CONFIG_ENABLE_TIME_SYNC=1
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_ENABLE_TIME_SYNC=1 -DOPENTHREAD_CONFIG_HEADER_IE_SUPPORT=1
|
||||
endif
|
||||
|
||||
ifeq ($(UDP_FORWARD),1)
|
||||
|
||||
@@ -663,13 +663,16 @@ otError MleRouter::HandleLinkRequest(const Message &aMessage, const Ip6::Message
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
if (Tlv::GetTlv(aMessage, Tlv::kTimeRequest, sizeof(timeRequest), timeRequest) == OT_ERROR_NONE)
|
||||
if (neighbor != NULL)
|
||||
{
|
||||
neighbor->SetTimeSyncEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
neighbor->SetTimeSyncEnabled(false);
|
||||
if (Tlv::GetTlv(aMessage, Tlv::kTimeRequest, sizeof(timeRequest), timeRequest) == OT_ERROR_NONE)
|
||||
{
|
||||
neighbor->SetTimeSyncEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
neighbor->SetTimeSyncEnabled(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -745,7 +748,7 @@ otError MleRouter::SendLinkAccept(const Ip6::MessageInfo &aMessageInfo,
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
if (aNeighbor->IsTimeSyncEnabled())
|
||||
if (aNeighbor != NULL && aNeighbor->IsTimeSyncEnabled())
|
||||
{
|
||||
message->SetTimeSync(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user