From ab7c1851fd3e6036f8ca707e16d5fc0f6edb1ad6 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 26 Jan 2023 10:25:12 +0100 Subject: [PATCH] MT#56321 core::AmOfferAnswer add logging into most important places We have to improve AmOfferAnswer functions in terms of adding more logging, to let the debug of the OA be more clear. Also in parallel the refactoring is done in scope of AmOfferAnswer in order to make reading more convenient. Change-Id: If7353f1285057760dd5fbeada984a5ef96af9854 --- core/AmMimeBody.cpp | 2 ++ core/AmOfferAnswer.cpp | 39 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/core/AmMimeBody.cpp b/core/AmMimeBody.cpp index 29e6820f..02fc94c0 100644 --- a/core/AmMimeBody.cpp +++ b/core/AmMimeBody.cpp @@ -648,6 +648,8 @@ void AmMimeBody::setHeaders(const string& hdrs) AmMimeBody* AmMimeBody::addPart(const string& content_type) { + DBG("Adding a new part to an existing body.\n"); + AmMimeBody* body = NULL; if(ct.type.empty() && ct.subtype.empty()) { // fill *this* body diff --git a/core/AmOfferAnswer.cpp b/core/AmOfferAnswer.cpp index a486c713..df12278c 100644 --- a/core/AmOfferAnswer.cpp +++ b/core/AmOfferAnswer.cpp @@ -270,31 +270,34 @@ int AmOfferAnswer::onRxSdp(unsigned int m_cseq, const AmMimeBody& body, const ch int AmOfferAnswer::onTxSdp(unsigned int m_cseq, const AmMimeBody& body) { - // assume that the payload is ok if it is not empty. - // (do not parse again self-generated SDP) - if(body.empty()){ + DBG("AmOfferAnswer::onTxSdp()\n"); + + /* assume that the payload is ok if it is not empty. + * (do not parse again self-generated SDP) */ + if (body.empty()) { + DBG("Body is empty, cannot do anything here.\n"); return -1; } - switch(state) { + switch (state) { - case OA_None: - case OA_Completed: - setState(OA_OfferSent); - cseq = m_cseq; - break; + case OA_None: + case OA_Completed: + setState(OA_OfferSent); + cseq = m_cseq; + break; - case OA_OfferRecved: - setState(OA_Completed); - break; + case OA_OfferRecved: + setState(OA_Completed); + break; - case OA_OfferSent: - // There is already a pending offer!!! - DBG("There is already a pending offer, onTxSdp fails\n"); - return -1; + case OA_OfferSent: + /* There is already a pending offer */ + DBG("There is already a pending offer, onTxSdp fails\n"); + return -1; - default: - break; + default: + break; } return 0;