From 06247b2d84833e398913e536b991a4341bdd2c11 Mon Sep 17 00:00:00 2001 From: Buke Po Date: Tue, 15 Aug 2017 11:12:23 -0500 Subject: [PATCH] [coap] fix handling message id 0 (#2104) --- src/core/coap/coap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/coap/coap.cpp b/src/core/coap/coap.cpp index de1705682..d2136ea03 100644 --- a/src/core/coap/coap.cpp +++ b/src/core/coap/coap.cpp @@ -175,7 +175,8 @@ otError Coap::SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessageInf } // Set Message Id if it was not already set. - if (header.GetMessageId() == 0) + if (header.GetMessageId() == 0 && + (header.GetType() == OT_COAP_TYPE_CONFIRMABLE || header.GetType() == OT_COAP_TYPE_NON_CONFIRMABLE)) { header.SetMessageId(mMessageId++); aMessage.Write(0, Header::kMinHeaderLength, header.GetBytes());