diff --git a/src/client/configurationmanager.cpp b/src/client/configurationmanager.cpp index a5fc3afba3162f813bd75bb0cca30d8a29a658ba..75fe81c85dcb0f63f27473110c7e161854f54e64 100644 --- a/src/client/configurationmanager.cpp +++ b/src/client/configurationmanager.cpp @@ -71,7 +71,6 @@ constexpr unsigned CODECS_NOT_LOADED = 0x1000; /** Codecs not found */ using jami::SIPAccount; using jami::JamiAccount; using jami::tls::TlsValidator; -using jami::tls::CertificateStore; using jami::AudioDeviceType; void diff --git a/src/connectivity/ice_transport.cpp b/src/connectivity/ice_transport.cpp index ecd0ae1fb8ab75324193ad687438d0b0585536cc..4fb2863009c34f961326c0e3d5f72a0e30138671 100644 --- a/src/connectivity/ice_transport.cpp +++ b/src/connectivity/ice_transport.cpp @@ -1712,43 +1712,6 @@ IceTransport::waitForData(unsigned compId, std::chrono::milliseconds timeout, st return pimpl_->peerChannels_.at(compId - 1).wait(timeout, ec); } -std::vector<SDP> -IceTransport::parseSDPList(const std::vector<uint8_t>& msg) -{ - std::vector<SDP> sdp_list; - - try { - size_t off = 0; - while (off != msg.size()) { - msgpack::unpacked result; - msgpack::unpack(result, (const char*) msg.data(), msg.size(), off); - SDP sdp; - if (result.get().type == msgpack::type::POSITIVE_INTEGER) { - // Version 1 - msgpack::unpack(result, (const char*) msg.data(), msg.size(), off); - std::tie(sdp.ufrag, sdp.pwd) = result.get().as<std::pair<std::string, std::string>>(); - msgpack::unpack(result, (const char*) msg.data(), msg.size(), off); - auto comp_cnt = result.get().as<uint8_t>(); - while (comp_cnt-- > 0) { - msgpack::unpack(result, (const char*) msg.data(), msg.size(), off); - auto candidates = result.get().as<std::vector<std::string>>(); - sdp.candidates.reserve(sdp.candidates.size() + candidates.size()); - sdp.candidates.insert(sdp.candidates.end(), - candidates.begin(), - candidates.end()); - } - } else { - result.get().convert(sdp); - } - sdp_list.emplace_back(std::move(sdp)); - } - } catch (const msgpack::unpack_error& e) { - JAMI_WARN("Error parsing sdp: %s", e.what()); - } - - return sdp_list; -} - bool IceTransport::isTCPEnabled() { diff --git a/src/connectivity/ice_transport.h b/src/connectivity/ice_transport.h index ad5be7d42d9c49b9780bf123043b69087b37d1ca..764b13751c1f8db66d61774026f3ccd0d679d0e1 100644 --- a/src/connectivity/ice_transport.h +++ b/src/connectivity/ice_transport.h @@ -229,13 +229,6 @@ public: bool setSlaveSession(); bool setInitiatorSession(); - /** - * Get SDP messages list - * @param msg The payload to parse - * @return the list of SDP messages - */ - static std::vector<SDP> parseSDPList(const std::vector<uint8_t>& msg); - bool isTCPEnabled(); ICESDP parseIceCandidates(std::string_view sdp_msg); diff --git a/src/connectivity/security/certstore.cpp b/src/connectivity/security/certstore.cpp index 32762ea3ef61ec445f3a96ee184402984a2b6c82..9aa8f6bd58be5d8124824bb7d1741c3e0b792ac0 100644 --- a/src/connectivity/security/certstore.cpp +++ b/src/connectivity/security/certstore.cpp @@ -87,7 +87,7 @@ CertificateStore::loadRevocations(crypto::Certificate& crt) const for (const auto& crl : fileutils::readDirectory(dir)) { try { crt.addRevocationList(std::make_shared<crypto::RevocationList>( - fileutils::loadFile(dir + DIR_SEPARATOR_CH + crl))); + fileutils::loadFile(fmt::format("{}/{}", dir, crl)))); } catch (const std::exception& e) { JAMI_WARN("Can't load revocation list: %s", e.what()); } @@ -95,7 +95,7 @@ CertificateStore::loadRevocations(crypto::Certificate& crt) const auto ocsp_dir = ocspPath_ + DIR_SEPARATOR_CH + crt.getId().toString(); for (const auto& ocsp : fileutils::readDirectory(ocsp_dir)) { try { - std::string ocsp_filepath = ocsp_dir + DIR_SEPARATOR_CH + ocsp; + auto ocsp_filepath = fmt::format("{}/{}", ocsp_dir, ocsp); JAMI_DEBUG("Found {:s}", ocsp_filepath); auto serial = crt.getSerialNumber(); if (dht::toHex(serial.data(), serial.size()) != ocsp) @@ -236,7 +236,7 @@ readCertificates(const std::string& path, const std::string& crl_path) if (fileutils::isDirectory(path)) { auto files = fileutils::readDirectory(path); for (const auto& file : files) { - auto certs = readCertificates(path + DIR_SEPARATOR_CH + file, crl_path); + auto certs = readCertificates(fmt::format("{}/{}", path, file), crl_path); ret.insert(std::end(ret), std::make_move_iterator(std::begin(certs)), std::make_move_iterator(std::end(certs))); diff --git a/src/jamidht/swarm/routing_table.cpp b/src/jamidht/swarm/routing_table.cpp index 7211972a0188a967c00494fe629b0c6f79abf464..2082f3bedb56bd85ae5f62442c66a11be2b90b08 100644 --- a/src/jamidht/swarm/routing_table.cpp +++ b/src/jamidht/swarm/routing_table.cpp @@ -252,14 +252,14 @@ RoutingTable::RoutingTable() } bool -RoutingTable::addNode(std::shared_ptr<ChannelSocketInterface> socket) +RoutingTable::addNode(const std::shared_ptr<ChannelSocketInterface>& socket) { auto bucket = findBucket(socket->deviceId()); return addNode(socket, bucket); } bool -RoutingTable::addNode(std::shared_ptr<ChannelSocketInterface> channel, +RoutingTable::addNode(const std::shared_ptr<ChannelSocketInterface>& channel, std::list<Bucket>::iterator& bucket) { NodeId nodeId = channel->deviceId(); diff --git a/src/jamidht/swarm/routing_table.h b/src/jamidht/swarm/routing_table.h index 3265b050d46b6c93d2f95589bcb6ab388787898c..03f1ce36a1db9d887c27e52c9b80bcf4fc281464 100644 --- a/src/jamidht/swarm/routing_table.h +++ b/src/jamidht/swarm/routing_table.h @@ -315,7 +315,7 @@ public: * @param socket * @return true if socket was added, false if not */ - bool addNode(std::shared_ptr<ChannelSocketInterface> socket); + bool addNode(const std::shared_ptr<ChannelSocketInterface>& socket); /** * Add socket to specific bucket @@ -323,7 +323,7 @@ public: * @param bucket * @return true if socket was added to bucket, false if not */ - bool addNode(std::shared_ptr<ChannelSocketInterface> channel, + bool addNode(const std::shared_ptr<ChannelSocketInterface>& channel, std::list<Bucket>::iterator& bucket); /** diff --git a/src/media/media_attribute.cpp b/src/media/media_attribute.cpp index 2292d234d92bb41cfdb3f3d8926e1183fbf4e9eb..9a468fd86a06eb4eab01b51970708f71dc85614f 100644 --- a/src/media/media_attribute.cpp +++ b/src/media/media_attribute.cpp @@ -171,7 +171,7 @@ std::vector<libjami::MediaMap> MediaAttribute::mediaAttributesToMediaMaps(std::vector<MediaAttribute> mediaAttrList) { std::vector<libjami::MediaMap> mediaList; - mediaAttrList.reserve(mediaAttrList.size()); + mediaList.reserve(mediaAttrList.size()); for (auto const& media : mediaAttrList) { mediaList.emplace_back(toMediaMap(media)); } diff --git a/src/sip/sipaccount.cpp b/src/sip/sipaccount.cpp index 08c005b892dd82703275ce67648caa9b6845966f..ce3e95ed16bb9ad37974e3fb1f50abde6c306feb 100644 --- a/src/sip/sipaccount.cpp +++ b/src/sip/sipaccount.cpp @@ -83,8 +83,6 @@ namespace jami { -using yaml_utils::parseValue; -using yaml_utils::parseValueOptional; using sip_utils::CONST_PJ_STR; static constexpr unsigned REGISTRATION_FIRST_RETRY_INTERVAL = 60; // seconds @@ -137,8 +135,12 @@ SIPAccount::SIPAccount(const std::string& accountID, bool presenceEnabled) SIPAccount::~SIPAccount() noexcept { // ensure that no registration callbacks survive past this point - destroyRegistrationInfo(); - setTransport(); + try { + destroyRegistrationInfo(); + setTransport(); + } catch (...) { + JAMI_ERR("Exception in SIPAccount destructor"); + } delete presence_; }