CoAP: enable response handler for CoAP response messages (#1719)

This is needed for detecting a canceled CoAP observe session.
This commit is contained in:
Giedrius
2017-05-15 12:03:32 -07:00
committed by Jonathan Hui
parent 8fa20a51f1
commit 91bce33102
+4 -2
View File
@@ -189,7 +189,7 @@ ThreadError Coap::SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessag
// Create a copy of entire message and enqueue it.
copyLength = aMessage.GetLength();
}
else if (header.IsNonConfirmable() && header.IsRequest() && (aHandler != NULL))
else if (header.IsNonConfirmable() && (aHandler != NULL))
{
// As we do not retransmit non confirmable messages, create a copy of header only, for token information.
copyLength = header.GetLength();
@@ -466,7 +466,9 @@ Message *Coap::FindRelatedRequest(const Header &aResponseHeader, const Ip6::Mess
aCoapMetadata.mDestinationAddress.IsAnycastRoutingLocator()) &&
(aCoapMetadata.mDestinationPort == aMessageInfo.GetPeerPort()))
{
assert(aRequestHeader.FromMessage(*message, sizeof(CoapMetadata)) == kThreadError_None);
// FromMessage can return kThreadError_Parse if only partial message was stored (header only),
// but payload marker is present. Assume, that stored messages are always valid.
aRequestHeader.FromMessage(*message, sizeof(CoapMetadata));
switch (aResponseHeader.GetType())
{