mirror of
https://github.com/espressif/openthread.git
synced 2026-08-11 05:07:47 +00:00
[meshcop] change "send" methods to return void (#4941)
This commit is contained in:
@@ -256,7 +256,7 @@ otError DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInf
|
||||
SuccessOrExit(
|
||||
Get<Mle::MleRouter>().GetCommissionerAloc(destination, localSessionId->GetCommissionerSessionId()));
|
||||
|
||||
IgnoreError(Get<Leader>().SendDatasetChanged(destination));
|
||||
Get<Leader>().SendDatasetChanged(destination);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
@@ -117,12 +117,12 @@ void Leader::HandlePetition(Coap::Message &aMessage, const Ip6::MessageInfo &aMe
|
||||
mTimer.Start(Time::SecToMsec(kTimeoutLeaderPetition));
|
||||
|
||||
exit:
|
||||
IgnoreError(SendPetitionResponse(aMessage, aMessageInfo, state));
|
||||
SendPetitionResponse(aMessage, aMessageInfo, state);
|
||||
}
|
||||
|
||||
otError Leader::SendPetitionResponse(const Coap::Message & aRequest,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
StateTlv::State aState)
|
||||
void Leader::SendPetitionResponse(const Coap::Message & aRequest,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
StateTlv::State aState)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Coap::Message *message;
|
||||
@@ -150,12 +150,15 @@ otError Leader::SendPetitionResponse(const Coap::Message & aRequest,
|
||||
|
||||
exit:
|
||||
|
||||
if (error != OT_ERROR_NONE && message != NULL)
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
otLogInfoMeshCoP("Failed to send petition response: %s", otThreadErrorToString(error));
|
||||
|
||||
return error;
|
||||
if (message != NULL)
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Leader::HandleKeepAlive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
||||
@@ -203,15 +206,15 @@ void Leader::HandleKeepAlive(Coap::Message &aMessage, const Ip6::MessageInfo &aM
|
||||
mTimer.Start(Time::SecToMsec(kTimeoutLeaderPetition));
|
||||
}
|
||||
|
||||
IgnoreError(SendKeepAliveResponse(aMessage, aMessageInfo, responseState));
|
||||
SendKeepAliveResponse(aMessage, aMessageInfo, responseState);
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError Leader::SendKeepAliveResponse(const Coap::Message & aRequest,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
StateTlv::State aState)
|
||||
void Leader::SendKeepAliveResponse(const Coap::Message & aRequest,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
StateTlv::State aState)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Coap::Message *message;
|
||||
@@ -229,15 +232,18 @@ otError Leader::SendKeepAliveResponse(const Coap::Message & aRequest,
|
||||
|
||||
exit:
|
||||
|
||||
if (error != OT_ERROR_NONE && message != NULL)
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
otLogWarnMeshCoP("Failed to send keep alive response: %s", otThreadErrorToString(error));
|
||||
|
||||
return error;
|
||||
if (message != NULL)
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
otError Leader::SendDatasetChanged(const Ip6::Address &aAddress)
|
||||
void Leader::SendDatasetChanged(const Ip6::Address &aAddress)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Ip6::MessageInfo messageInfo;
|
||||
@@ -256,12 +262,15 @@ otError Leader::SendDatasetChanged(const Ip6::Address &aAddress)
|
||||
|
||||
exit:
|
||||
|
||||
if (error != OT_ERROR_NONE && message != NULL)
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
otLogWarnMeshCoP("Failed to send dataset changed: %s", otThreadErrorToString(error));
|
||||
|
||||
return error;
|
||||
if (message != NULL)
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
otError Leader::SetDelayTimerMinimal(uint32_t aDelayTimerMinimal)
|
||||
|
||||
@@ -77,11 +77,8 @@ public:
|
||||
*
|
||||
* @param[in] aAddress The IPv6 address of destination.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully send MGMT_DATASET_CHANGED message.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffers to generate a MGMT_DATASET_CHANGED message.
|
||||
*
|
||||
*/
|
||||
otError SendDatasetChanged(const Ip6::Address &aAddress);
|
||||
void SendDatasetChanged(const Ip6::Address &aAddress);
|
||||
|
||||
/**
|
||||
* This method sets minimal delay timer.
|
||||
@@ -119,13 +116,13 @@ private:
|
||||
|
||||
static void HandlePetition(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||
void HandlePetition(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
otError SendPetitionResponse(const Coap::Message & aRequest,
|
||||
void SendPetitionResponse(const Coap::Message & aRequest,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
StateTlv::State aState);
|
||||
|
||||
static void HandleKeepAlive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||
void HandleKeepAlive(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
otError SendKeepAliveResponse(const Coap::Message & aRequest,
|
||||
void SendKeepAliveResponse(const Coap::Message & aRequest,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
StateTlv::State aState);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user