mirror of
https://github.com/espressif/openthread.git
synced 2026-08-06 10:47:46 +00:00
[border-agent] handle error responses from leader (#4097)
This commit removes an assumption in the border agent that COM_PET.rsp from the leader 1is CHANGED. It is possible for the leader to return a 4.XX error response. In that case, the border agent should forward the error response.
This commit is contained in:
@@ -230,10 +230,10 @@ void BorderAgent::HandleCoapResponse(void * aContext,
|
||||
Coap::Message * message = NULL;
|
||||
otError error;
|
||||
|
||||
VerifyOrExit((message = NewMeshCoPMessage(instance.Get<Coap::CoapSecure>())) != NULL, error = OT_ERROR_NO_BUFS);
|
||||
SuccessOrExit(error = aResult);
|
||||
VerifyOrExit((message = NewMeshCoPMessage(instance.Get<Coap::CoapSecure>())) != NULL, error = OT_ERROR_NO_BUFS);
|
||||
|
||||
if (forwardContext.IsPetition())
|
||||
if (forwardContext.IsPetition() && response->GetCode() == OT_COAP_CODE_CHANGED)
|
||||
{
|
||||
StateTlv stateTlv;
|
||||
|
||||
@@ -257,7 +257,7 @@ void BorderAgent::HandleCoapResponse(void * aContext,
|
||||
|
||||
SuccessOrExit(error = forwardContext.ToHeader(*message, response->GetCode()));
|
||||
|
||||
if (response->GetLength() - response->GetOffset() > 0)
|
||||
if (response->GetLength() > response->GetOffset())
|
||||
{
|
||||
SuccessOrExit(error = message->SetPayloadMarker());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user