Skip to content
Snippets Groups Projects
Select Git revision
  • 4e85791e0face1f157b922eba4970fc15708ed53
  • master default protected
  • release/202005
  • release/202001
  • release/201912
  • release/201911
  • release/releaseWindowsTestOne
  • release/windowsReleaseTest
  • release/releaseTest
  • release/releaseWindowsTest
  • release/201910
  • release/qt/201910
  • release/windows-test/201910
  • release/201908
  • release/201906
  • release/201905
  • release/201904
  • release/201903
  • release/201902
  • release/201901
  • release/201812
  • 4.0.0
  • 2.2.0
  • 2.1.0
  • 2.0.1
  • 2.0.0
  • 1.4.1
  • 1.4.0
  • 1.3.0
  • 1.2.0
  • 1.1.0
31 results

fileutils.cpp

Blame
    • Emmanuel Lepage Vallee's avatar
      4e85791e
      build: Fix some GCC5.1 warnings · 4e85791e
      Emmanuel Lepage Vallee authored
      Not all warnings have been enabled, only the most
      useful ones. This fix some outstanding issues and
      try to mute most deprecated warnings in dependencies
      headers.
      
      * Add missing "defined()" macro function
      * Undefine an improper macro
      * Disable warnings for legacy code include
      * Add missing cases for enum classes based switch
      * Add a warning for potentially dangerous code
      * Change ICE "onRecv()" prototype to return void
      * Fix an apparently accidental virtual override signature problem
      * Change a std::basic_string constructor to avoid ambiguity
      
      Refs #74147
      
      Change-Id: I1361fc5d16c63fd7590f8d68ffdb0e2588a8b635
      4e85791e
      History
      build: Fix some GCC5.1 warnings
      Emmanuel Lepage Vallee authored
      Not all warnings have been enabled, only the most
      useful ones. This fix some outstanding issues and
      try to mute most deprecated warnings in dependencies
      headers.
      
      * Add missing "defined()" macro function
      * Undefine an improper macro
      * Disable warnings for legacy code include
      * Add missing cases for enum classes based switch
      * Add a warning for potentially dangerous code
      * Change ICE "onRecv()" prototype to return void
      * Fix an apparently accidental virtual override signature problem
      * Change a std::basic_string constructor to avoid ambiguity
      
      Refs #74147
      
      Change-Id: I1361fc5d16c63fd7590f8d68ffdb0e2588a8b635
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    connectionmanager.cpp 61.14 KiB
    /*
     *  Copyright (C) 2019-2023 Savoir-faire Linux Inc.
     *  Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
     *
     *  This program is free software; you can redistribute it and/or modify
     *  it under the terms of the GNU General Public License as published by
     *  the Free Software Foundation; either version 3 of the License, or
     *  (at your option) any later version.
     *
     *  This program is distributed in the hope that it will be useful,
     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *  GNU General Public License for more details.
     *
     *  You should have received a copy of the GNU General Public License
     *  along with this program. If not, see <https://www.gnu.org/licenses/>.
     */
    #include "connectionmanager.h"
    #include "peer_connection.h"
    #include "upnp/upnp_control.h"
    #include "certstore.h"
    #include "fileutils.h"
    #include "sip_utils.h"
    #include "string_utils.h"
    
    #include <opendht/crypto.h>
    #include <opendht/thread_pool.h>
    #include <opendht/value.h>
    #include <asio.hpp>
    
    #include <algorithm>
    #include <mutex>
    #include <map>
    #include <condition_variable>
    #include <set>
    #include <charconv>
    
    namespace jami {
    static constexpr std::chrono::seconds DHT_MSG_TIMEOUT {30};
    static constexpr uint64_t ID_MAX_VAL = 9007199254740992;
    
    using ValueIdDist = std::uniform_int_distribution<dht::Value::Id>;
    using CallbackId = std::pair<jami::DeviceId, dht::Value::Id>;
    
    struct ConnectionInfo
    {
        ~ConnectionInfo()
        {
            if (socket_)
                socket_->join();
        }
    
        std::mutex mutex_ {};
        bool responseReceived_ {false};
        PeerConnectionRequest response_ {};
        std::unique_ptr<IceTransport> ice_ {nullptr};
        // Used to store currently non ready TLS Socket
        std::unique_ptr<TlsSocketEndpoint> tls_ {nullptr};
        std::shared_ptr<MultiplexedSocket> socket_ {};
        std::set<CallbackId> cbIds_ {};
    
        std::function<void(bool)> onConnected_;
        std::unique_ptr<asio::steady_timer> waitForAnswer_ {};
    };
    
    /**
     * returns whether or not UPnP is enabled and active_
     * ie: if it is able to make port mappings
     */
    bool