From 51256a479c636213f170a77b4205e222382aa760 Mon Sep 17 00:00:00 2001 From: Andrea Gianarda <andrea.gianarda@belledonne-communications.com> Date: Tue, 11 Mar 2025 15:01:55 +0100 Subject: [PATCH] Avoid decrementing CCMP conference information counter when the HTTP request of the conference list fails In fact, at such early stage, the core is still waiting for the conference list in order to spawn off one HTTP request for every conference to retrieve its information --- src/account/account.cpp | 38 ++++++++++++++++++++++++++++++-------- src/account/account.h | 6 ++++-- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/account/account.cpp b/src/account/account.cpp index 1300d019d7..b8d394264f 100644 --- a/src/account/account.cpp +++ b/src/account/account.cpp @@ -1767,11 +1767,11 @@ void Account::handleCCMPResponseConferenceList(const HttpResponse &response) { handleResponseConferenceList(this, response); break; case HttpResponse::Status::Timeout: - handleTimeout(this, response); + handleTimeoutConferenceList(this, response); break; case HttpResponse::Status::IOError: case HttpResponse::Status::InvalidRequest: - handleIoError(this, response); + handleIoErrorConferenceList(this, response); break; } } @@ -1782,11 +1782,11 @@ void Account::handleCCMPResponseConferenceInformation(const HttpResponse &respon handleResponseConferenceInformation(this, response); break; case HttpResponse::Status::Timeout: - handleTimeout(this, response); + handleTimeoutConferenceInformation(this, response); break; case HttpResponse::Status::IOError: case HttpResponse::Status::InvalidRequest: - handleIoError(this, response); + handleIoErrorConferenceInformation(this, response); break; } } @@ -1906,6 +1906,24 @@ void Account::handleResponseConferenceList(void *ctx, const HttpResponse &event) } } +void Account::handleIoErrorConferenceList(void *ctx, const HttpResponse &event) { + auto account = static_cast<Account *>(ctx); + const auto ccmpServerUrl = account->getAccountParams()->getCcmpServerUrl(); + const auto &body = event.getBody(); + auto content = body.getBodyAsString(); + lInfo() << "I/O error on retrieving the conference list " << *account << " belongs to from the CCMP server " + << ccmpServerUrl << ": " << content; +} + +void Account::handleTimeoutConferenceList(void *ctx, const HttpResponse &event) { + auto account = static_cast<Account *>(ctx); + const auto ccmpServerUrl = account->getAccountParams()->getCcmpServerUrl(); + const auto &body = event.getBody(); + auto content = body.getBodyAsString(); + lInfo() << "Timeout error on retrieving the conference list " << *account << " belongs to from the CCMP server " + << ccmpServerUrl << ": " << content; +} + void Account::handleResponseConferenceInformation(void *ctx, const HttpResponse &event) { auto account = static_cast<Account *>(ctx); int code = event.getHttpStatusCode(); @@ -2066,19 +2084,23 @@ void Account::handleResponseConferenceInformation(void *ctx, const HttpResponse account->ccmpConferenceInformationResponseReceived(); } -void Account::handleIoError(void *ctx, const HttpResponse &event) { +void Account::handleIoErrorConferenceInformation(void *ctx, const HttpResponse &event) { auto account = static_cast<Account *>(ctx); + const auto ccmpServerUrl = account->getAccountParams()->getCcmpServerUrl(); const auto &body = event.getBody(); auto content = body.getBodyAsString(); - lInfo() << "Account [" << account << "] I/O error : " << content; + lInfo() << *account << ": I/O error on retrieving the information of a conference from the CCMP server " + << ccmpServerUrl << ": " << content; account->ccmpConferenceInformationResponseReceived(); } -void Account::handleTimeout(void *ctx, const HttpResponse &event) { +void Account::handleTimeoutConferenceInformation(void *ctx, const HttpResponse &event) { auto account = static_cast<Account *>(ctx); + const auto ccmpServerUrl = account->getAccountParams()->getCcmpServerUrl(); const auto &body = event.getBody(); auto content = body.getBodyAsString(); - lInfo() << "Account [" << account << "] Timeout error : " << content; + lInfo() << *account << ": Timeout error on retrieving the information of a conference from the CCMP server " + << ccmpServerUrl << ": " << content; account->ccmpConferenceInformationResponseReceived(); } diff --git a/src/account/account.h b/src/account/account.h index 81d1062fab..1e71b3b79e 100644 --- a/src/account/account.h +++ b/src/account/account.h @@ -178,9 +178,11 @@ public: void handleCCMPResponseConferenceInformation(const HttpResponse &response); // CCMP request callback (conference list) static void handleResponseConferenceList(void *ctx, const HttpResponse &event); + static void handleTimeoutConferenceList(void *ctx, const HttpResponse &event); + static void handleIoErrorConferenceList(void *ctx, const HttpResponse &event); static void handleResponseConferenceInformation(void *ctx, const HttpResponse &event); - static void handleTimeout(void *ctx, const HttpResponse &event); - static void handleIoError(void *ctx, const HttpResponse &event); + static void handleTimeoutConferenceInformation(void *ctx, const HttpResponse &event); + static void handleIoErrorConferenceInformation(void *ctx, const HttpResponse &event); private: LinphoneCore *getCCore() const; -- GitLab