diff --git a/src/config/yamlparser.h b/src/config/yamlparser.h index 9e2efe8301515cf0996c5922c567d34d81bfabf4..9c66a6de396093c1dcb247c5218b35aa2afd4084 100644 --- a/src/config/yamlparser.h +++ b/src/config/yamlparser.h @@ -44,7 +44,7 @@ parseValueOptional(const YAML::Node& node, const char* key, T& value) parseValue(node, key, value); return true; } catch (const std::exception& e) { - JAMI_DBG("Can't read yaml field: %s", key); + // JAMI_DBG("Can't read yaml field: %s", key); } return false; } diff --git a/src/im/message_engine.cpp b/src/im/message_engine.cpp index 568051ae71ff616d76b81f637c02e43578eba5a6..97ac49bd167cfdbe459ea73970308462fee3b30b 100644 --- a/src/im/message_engine.cpp +++ b/src/im/message_engine.cpp @@ -227,10 +227,12 @@ MessageEngine::load() loaded++; } } - JAMI_DBG("[Account %s] loaded %lu messages from %s", - account_.getAccountID().c_str(), - loaded, - savePath_.c_str()); + if (loaded > 0) { + JAMI_DBG("[Account %s] loaded %lu messages from %s", + account_.getAccountID().c_str(), + loaded, + savePath_.c_str()); + } } catch (const std::exception& e) { JAMI_DBG("[Account %s] couldn't load messages from %s: %s", account_.getAccountID().c_str(), diff --git a/src/jamidht/contact_list.cpp b/src/jamidht/contact_list.cpp index bb4b4ec8fcd98441a8a322cbfd79367e3615b7ab..7dd66f81ad021b454e111bce5bcdaef9f523eb47 100644 --- a/src/jamidht/contact_list.cpp +++ b/src/jamidht/contact_list.cpp @@ -163,7 +163,7 @@ ContactList::updateContact(const dht::InfoHash& id, const Contact& contact) bool stateChanged {false}; auto c = contacts_.find(id); if (c == contacts_.end()) { - JAMI_DBG("[Contacts] new contact: %s", id.toString().c_str()); + // JAMI_DBG("[Contacts] new contact: %s", id.toString().c_str()); c = contacts_.emplace(id, contact).first; stateChanged = c->second.isActive() or c->second.isBanned(); } else { @@ -355,9 +355,9 @@ ContactList::loadKnownDevices() } for (const auto& d : knownDevices) { - JAMI_DBG("[Contacts] loading known account device %s %s", + /*JAMI_DBG("[Contacts] loading known account device %s %s", d.second.first.c_str(), - d.first.toString().c_str()); + d.first.toString().c_str());*/ if (auto crt = tls::CertificateStore::instance().getCertificate(d.first.toString())) { if (not foundAccountDevice(crt, d.second.first, clock::from_time_t(d.second.second))) JAMI_WARN("[Contacts] can't add device %s", d.first.toString().c_str()); @@ -413,35 +413,37 @@ ContactList::foundAccountDevice(const std::shared_ptr<dht::crypto::Certificate>& if (not crt) return false; + auto id = crt->getId(); + // match certificate chain auto verifyResult = accountTrust_.verify(*crt); if (not verifyResult) { JAMI_WARN("[Contacts] Found invalid account device: %s: %s", - crt->getId().toString().c_str(), + id.toString().c_str(), verifyResult.toString().c_str()); return false; } // insert device - auto it = knownDevices_.emplace(crt->getId(), KnownDevice {crt, name, updated}); + auto it = knownDevices_.emplace(id, KnownDevice {crt, name, updated}); if (it.second) { JAMI_DBG("[Contacts] Found account device: %s %s", name.c_str(), - crt->getId().toString().c_str()); + id.toString().c_str()); tls::CertificateStore::instance().pinCertificate(crt); if (crt->ocspResponse) { unsigned int status = crt->ocspResponse->getCertificateStatus(); if (status == GNUTLS_OCSP_CERT_GOOD) { - JAMI_DBG("Certificate %s has good OCSP status", crt->getId().to_c_str()); - trust_.setCertificateStatus(crt->getId().toString(), + JAMI_DBG("Certificate %s has good OCSP status", id.to_c_str()); + trust_.setCertificateStatus(id.toString(), tls::TrustStore::PermissionStatus::ALLOWED); } else if (status == GNUTLS_OCSP_CERT_REVOKED) { - JAMI_ERR("Certificate %s has revoked OCSP status", crt->getId().to_c_str()); - trust_.setCertificateStatus(crt->getId().toString(), + JAMI_ERR("Certificate %s has revoked OCSP status", id.to_c_str()); + trust_.setCertificateStatus(id.toString(), tls::TrustStore::PermissionStatus::BANNED); } else { - JAMI_ERR("Certificate %s has unknown OCSP status", crt->getId().to_c_str()); - trust_.setCertificateStatus(crt->getId().toString(), + JAMI_ERR("Certificate %s has unknown OCSP status", id.to_c_str()); + trust_.setCertificateStatus(id.toString(), tls::TrustStore::PermissionStatus::UNDEFINED); } } @@ -452,7 +454,7 @@ ContactList::foundAccountDevice(const std::shared_ptr<dht::crypto::Certificate>& if (not name.empty() and it.first->second.name != name) { JAMI_DBG("[Contacts] updating device name: %s %s", name.c_str(), - crt->getId().toString().c_str()); + id.to_c_str()); it.first->second.name = name; saveKnownDevices(); callbacks_.devicesChanged(knownDevices_); diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 89c7fd605113b7bc2f8a9dfcc1b42f81c7bd07ec..d9748e5eed0aa36f388c39a7f300177f6614aea4 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -313,7 +313,7 @@ JamiAccount::JamiAccount(const std::string& accountID, bool /* presenceEnabled * std::chrono::hours(24 * 7))); std::getline(is, proxyServerCached_); } catch (const std::exception& e) { - JAMI_DBG("Can't load proxy URL from cache: %s", e.what()); + JAMI_DBG("[Account %s] Can't load proxy URL from cache: %s", getAccountID().c_str(), e.what()); } setActiveCodecs({}); @@ -1960,7 +1960,7 @@ JamiAccount::loadBootstrap() const while (std::getline(ss, node_addr, ';')) bootstrap.emplace_back(std::move(node_addr)); for (const auto& b : bootstrap) - JAMI_DBG("Bootstrap node: %s", b.c_str()); + JAMI_DBG("[Account %s] Bootstrap node: %s", getAccountID().c_str(), b.c_str()); } return bootstrap; } @@ -3578,7 +3578,7 @@ JamiAccount::cacheTurnServers() this_->isRefreshing_ = false; return; } - JAMI_INFO("Refresh cache for TURN server resolution"); + JAMI_INFO("[Account %s] Refresh cache for TURN server resolution", this_->getAccountID().c_str()); // Retrieve old cached value if available. // This means that we directly get the correct value when launching the application on the // same network @@ -3628,7 +3628,7 @@ JamiAccount::cacheTurnServers() this_->cacheTurnV6_ = std::make_unique<IpAddr>(std::move(turnV6)); } this_->isRefreshing_ = false; - JAMI_INFO("Cache refreshed for TURN resolution"); + JAMI_INFO("[Account %s] Cache refreshed for TURN resolution", this_->getAccountID().c_str()); }); } @@ -3662,12 +3662,12 @@ JamiAccount::requestSIPConnection(const std::string& peerId, const DeviceId& dev auto id = std::make_pair(peerId, deviceId); if (sipConns_.find(id) != sipConns_.end()) { - JAMI_DBG("A SIP connection with %s already exists", deviceId.to_c_str()); + JAMI_DBG("[Account %s] A SIP connection with %s already exists", getAccountID().c_str(), deviceId.to_c_str()); return; } sipConns_[id] = {}; // If not present, create it - JAMI_INFO("Ask %s for a new SIP channel", deviceId.to_c_str()); + JAMI_INFO("[Account %s] Ask %s for a new SIP channel", getAccountID().c_str(), deviceId.to_c_str()); if (!connectionManager_) return; connectionManager_->connectDevice(deviceId, @@ -3855,7 +3855,7 @@ JamiAccount::cacheSIPConnection(std::shared_ptr<ChannelSocket>&& socket, return v.channel == socket; }); if (conn != connections.end()) { - JAMI_WARN("Channel socket already cached with this peer"); + JAMI_WARN("[Account %s] Channel socket already cached with this peer", getAccountID().c_str()); return; } @@ -3890,7 +3890,7 @@ JamiAccount::cacheSIPConnection(std::shared_ptr<ChannelSocket>&& socket, sip_tr->setAccount(shared()); // Store the connection connections.emplace_back(SipConnection {sip_tr, socket}); - JAMI_WARN("New SIP channel opened with %s", deviceId.to_c_str()); + JAMI_WARN("[Account %s] New SIP channel opened with %s", getAccountID().c_str(), deviceId.to_c_str()); lk.unlock(); sendProfile(deviceId.toString()); diff --git a/src/media/audio/ringbufferpool.cpp b/src/media/audio/ringbufferpool.cpp index 49b9809d91ef0fc0b093572a5caecd302293e166..147767d3ca5b7cc71f347e71f529bbe9ed8b6448 100644 --- a/src/media/audio/ringbufferpool.cpp +++ b/src/media/audio/ringbufferpool.cpp @@ -115,8 +115,7 @@ RingBufferPool::createRingBuffer(const std::string& id) } rbuf.reset(new RingBuffer(id, SIZEBUF, internalAudioFormat_)); - JAMI_DBG("Ringbuffer created with id '%s'", id.c_str()); - ringBufferMap_.insert(std::make_pair(id, std::weak_ptr<RingBuffer>(rbuf))); + ringBufferMap_.emplace(id, std::weak_ptr<RingBuffer>(rbuf)); return rbuf; } diff --git a/src/sip/siptransport.cpp b/src/sip/siptransport.cpp index 2ddf54040bf8c11117848d2b7e018a3969726c02..b4943392f4cbf855fffcca39e72df0b52b24ac58 100644 --- a/src/sip/siptransport.cpp +++ b/src/sip/siptransport.cpp @@ -187,14 +187,10 @@ SipTransport::getTlsMtu() SipTransportBroker::SipTransportBroker(pjsip_endpoint* endpt) : endpt_(endpt) -{ - JAMI_DBG("SipTransportBroker@%p", this); -} +{} SipTransportBroker::~SipTransportBroker() { - JAMI_DBG("~SipTransportBroker@%p", this); - shutdown(); udpTransports_.clear(); diff --git a/src/sip/sipvoiplink.cpp b/src/sip/sipvoiplink.cpp index 7c3a8541971574c6f4006d78f0a97d7e395eb1ab..25132634f51a6928e3a31b5a3479806e14ad7586 100644 --- a/src/sip/sipvoiplink.cpp +++ b/src/sip/sipvoiplink.cpp @@ -647,7 +647,7 @@ SIPVoIPLink::SIPVoIPLink() TRY(pjsip_100rel_init_module(endpt_)); // Initialize and register ring module - mod_ua_.name = pj_str((char*) PACKAGE); + mod_ua_.name = sip_utils::CONST_PJ_STR(PACKAGE); mod_ua_.id = -1; mod_ua_.priority = PJSIP_MOD_PRIORITY_APPLICATION; mod_ua_.on_rx_request = &transaction_request_cb;