Skip to content

Commit

Permalink
Merge pull request AirenSoft#5 from AirenSoft/master
Browse files Browse the repository at this point in the history
Fixed an issue with connecting two Origins simultaneously on one Edge…
  • Loading branch information
deepsurvey authored Oct 20, 2020
2 parents c6b2347 + 0f102a7 commit d8e8fcc
Show file tree
Hide file tree
Showing 40 changed files with 1,940 additions and 1,761 deletions.
4 changes: 2 additions & 2 deletions src/projects/base/base_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ServerBase : protected PhysicalPortObserver
return false;
}

_physical_port = PhysicalPortManager::Instance()->CreatePort(socket_type, address);
_physical_port = PhysicalPortManager::GetInstance()->CreatePort(socket_type, address);

if(_physical_port != nullptr)
{
Expand All @@ -72,7 +72,7 @@ class ServerBase : protected PhysicalPortObserver
}

_physical_port->RemoveObserver(this);
PhysicalPortManager::Instance()->DeletePort(_physical_port);
PhysicalPortManager::GetInstance()->DeletePort(_physical_port);
_physical_port = nullptr;

return true;
Expand Down
11 changes: 9 additions & 2 deletions src/projects/base/info/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@

#include "stream.h"

class Orchestrator;
// Forward declaration
namespace ocst
{
class Orchestrator;
class OrchestratorInternal;
} // namespace ocst

namespace info
{
Expand Down Expand Up @@ -163,7 +168,9 @@ namespace info

protected:
// These constructors will be called from Orchestrator
friend class ::Orchestrator;
friend class ocst::Orchestrator;
friend class ocst::OrchestratorInternal;

Application(const info::Host &host_info, application_id_t app_id, const VHostAppName &name, cfg::Application app_config, bool is_dynamic_app);
Application(const info::Host &host_info, application_id_t app_id, const VHostAppName &name, bool is_dynamic_app);

Expand Down
4 changes: 2 additions & 2 deletions src/projects/base/ovcrypto/openssl/openssl_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ namespace ov
{
if (mode & CRYPTO_LOCK)
{
OpensslManager::Instance()->MutexLock(n, file, line);
OpensslManager::GetInstance()->MutexLock(n, file, line);
}
else
{
OpensslManager::Instance()->MutexUnlock(n, file, line);
OpensslManager::GetInstance()->MutexUnlock(n, file, line);
}
}
} // namespace ov
4 changes: 2 additions & 2 deletions src/projects/base/ovcrypto/openssl/tls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace ov

if (bio_method == nullptr)
{
bio_method = OpensslManager::Instance()->GetBioMethod(OV_TLS_BIO_METHOD_NAME);
bio_method = OpensslManager::GetInstance()->GetBioMethod(OV_TLS_BIO_METHOD_NAME);

if (bio_method != nullptr)
{
Expand All @@ -52,7 +52,7 @@ namespace ov

if (result == false)
{
OpensslManager::Instance()->FreeBioMethod(OV_TLS_BIO_METHOD_NAME);
OpensslManager::GetInstance()->FreeBioMethod(OV_TLS_BIO_METHOD_NAME);
::BIO_meth_free(bio_method);

bio_method = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/projects/base/ovlibrary/singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ov
public:
virtual ~Singleton() = default;

static T *Instance()
static T *GetInstance()
{
static T instance;

Expand Down
6 changes: 3 additions & 3 deletions src/projects/base/provider/provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <base/common_types.h>
#include <base/mediarouter/media_route_interface.h>
#include <orchestrator/data_structure.h>
#include <orchestrator/data_structures/data_structure.h>

#include <shared_mutex>

Expand All @@ -19,7 +19,7 @@ namespace pvd
class Application;
class Stream;
// RTMP Server와 같은 모든 Provider는 다음 Interface를 구현하여 MediaRouterInterface에 자신을 등록한다.
class Provider : public OrchestratorModuleInterface
class Provider : public ocst::ModuleInterface
{
public:
virtual ProviderType GetProviderType() const = 0;
Expand Down Expand Up @@ -47,7 +47,7 @@ namespace pvd
virtual bool OnDeleteProviderApplication(const std::shared_ptr<pvd::Application> &application) = 0;

//--------------------------------------------------------------------
// Implementation of OrchestratorModuleInterface
// Implementation of ModuleInterface
//--------------------------------------------------------------------
bool OnCreateApplication(const info::Application &app_info) override;
bool OnDeleteApplication(const info::Application &app_info) override;
Expand Down
12 changes: 6 additions & 6 deletions src/projects/base/provider/pull_provider/provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <base/common_types.h>
#include <base/provider/provider.h>
#include <base/mediarouter/media_route_interface.h>
#include <orchestrator/data_structure.h>
#include <orchestrator/data_structures/data_structure.h>

#include <shared_mutex>

Expand Down Expand Up @@ -72,13 +72,13 @@ namespace pvd
class PullApplication;
class PullStream;
// RTMP Server와 같은 모든 Provider는 다음 Interface를 구현하여 MediaRouterInterface에 자신을 등록한다.
class PullProvider : public Provider, public OrchestratorPullProviderModuleInterface
class PullProvider : public Provider, public ocst::PullProviderModuleInterface
{
public:
// Implementation OrchestratorModuleInterface
OrchestratorModuleType GetModuleType() const override
// Implementation ModuleInterface
ocst::ModuleType GetModuleType() const override
{
return OrchestratorModuleType::PullProvider;
return ocst::ModuleType::PullProvider;
}

protected:
Expand All @@ -89,7 +89,7 @@ namespace pvd
bool UnlockPullStreamIfNeeded(const info::Application &app_info, const ov::String &stream_name, PullingItem::PullingItemState state);

//--------------------------------------------------------------------
// Implementation of OrchestratorPullProviderModuleInterface
// Implementation of PullProviderModuleInterface
//--------------------------------------------------------------------
std::shared_ptr<pvd::Stream> PullStream(const info::Application &app_info, const ov::String &stream_name, const std::vector<ov::String> &url_list, off_t offset) override;
bool StopStream(const info::Application &app_info, const std::shared_ptr<pvd::Stream> &stream) override;
Expand Down
6 changes: 3 additions & 3 deletions src/projects/base/provider/push_provider/provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ namespace pvd
class PushProvider : public Provider
{
public:
// Implementation Provider -> OrchestratorModuleInterface
OrchestratorModuleType GetModuleType() const override
// Implementation Provider -> ModuleInterface
ocst::ModuleType GetModuleType() const override
{
return OrchestratorModuleType::PushProvider;
return ocst::ModuleType::PushProvider;
}

// Call CreateServer and store the server
Expand Down
4 changes: 2 additions & 2 deletions src/projects/base/publisher/publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ namespace pub
return stream;
}

auto orchestrator = Orchestrator::GetInstance();
auto orchestrator = ocst::Orchestrator::GetInstance();
auto &vapp_name = vhost_app_name.ToString();

ov::String pull_url;
Expand Down Expand Up @@ -251,7 +251,7 @@ namespace pub

SignedUrlErrCode Publisher::HandleSignedUrl(const std::shared_ptr<const ov::Url> &request_url, const std::shared_ptr<ov::SocketAddress> &client_address, std::shared_ptr<const SignedUrl> &signed_url, ov::String &err_message)
{
auto orchestrator = Orchestrator::GetInstance();
auto orchestrator = ocst::Orchestrator::GetInstance();
auto &server_config = GetServerConfig();
auto vhost_name = orchestrator->GetVhostNameFromDomain(request_url->Domain());

Expand Down
4 changes: 2 additions & 2 deletions src/projects/base/publisher/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace pub


// All publishers such as WebRTC, HLS and MPEG-DASH has to inherit the Publisher class and implement that interfaces
class Publisher : public OrchestratorPublisherModuleInterface
class Publisher : public ocst::PublisherModuleInterface
{
public:
virtual bool Start();
Expand Down Expand Up @@ -135,7 +135,7 @@ namespace pub
virtual bool GetMonitoringCollectionData(std::vector<std::shared_ptr<pub::MonitoringCollectionData>> &collections) = 0;

//--------------------------------------------------------------------
// Implementation of OrchestratorModuleInterface
// Implementation of ModuleInterface
//--------------------------------------------------------------------
bool OnCreateApplication(const info::Application &app_info) override;
bool OnDeleteApplication(const info::Application &app_info) override;
Expand Down
6 changes: 3 additions & 3 deletions src/projects/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ int main(int argc, char *argv[])

const bool is_service = parse_option.start_service;

std::shared_ptr<cfg::Server> server_config = cfg::ConfigManager::Instance()->GetServer();
std::shared_ptr<cfg::Server> server_config = cfg::ConfigManager::GetInstance()->GetServer();
auto &hosts = server_config->GetVirtualHostList();
std::vector<std::shared_ptr<WebConsoleServer>> web_console_servers;

std::vector<info::Host> host_info_list;
std::map<ov::String, bool> vhost_map;

auto orchestrator = Orchestrator::GetInstance();
auto orchestrator = ocst::Orchestrator::GetInstance();
auto monitor = mon::Monitoring::GetInstance();

// Create info::Host
Expand Down Expand Up @@ -314,7 +314,7 @@ static ov::Daemon::State Initialize(int argc, char *argv[], ParseOption *parse_o

ov::LogWrite::Initialize(parse_option->start_service);

if (cfg::ConfigManager::Instance()->LoadConfigs(parse_option->config_path) == false)
if (cfg::ConfigManager::GetInstance()->LoadConfigs(parse_option->config_path) == false)
{
logte("An error occurred while load config");
return ov::Daemon::State::CHILD_FAIL;
Expand Down
4 changes: 2 additions & 2 deletions src/projects/main/signals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void ReloadHandler(int signum, siginfo_t *si, void *unused)
{
logti("Trying to reload configuration...");

auto config_manager = cfg::ConfigManager::Instance();
auto config_manager = cfg::ConfigManager::GetInstance();

if (config_manager->ReloadConfigs() == false)
{
Expand All @@ -179,7 +179,7 @@ static void ReloadHandler(int signum, siginfo_t *si, void *unused)
host_info_list.emplace_back(host);
}

if (Orchestrator::GetInstance()->ApplyOriginMap(host_info_list) == false)
if (ocst::Orchestrator::GetInstance()->ApplyOriginMap(host_info_list) == false)
{
logte("Could not reload OriginMap");
}
Expand Down
4 changes: 2 additions & 2 deletions src/projects/main/third_parties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const char *GetOpenSslVersion()

std::shared_ptr<ov::Error> InitializeOpenSsl()
{
if (ov::OpensslManager::Instance()->InitializeOpenssl())
if (ov::OpensslManager::GetInstance()->InitializeOpenssl())
{
return nullptr;
}
Expand All @@ -295,7 +295,7 @@ std::shared_ptr<ov::Error> InitializeOpenSsl()

std::shared_ptr<ov::Error> TerminateOpenSsl()
{
if (ov::OpensslManager::Instance()->ReleaseOpenSSL())
if (ov::OpensslManager::GetInstance()->ReleaseOpenSSL())
{
return nullptr;
}
Expand Down
4 changes: 2 additions & 2 deletions src/projects/mediarouter/mediarouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <config/config.h>
#include <orchestrator/orchestrator.h>

class MediaRouter : public MediaRouteInterface, public OrchestratorMediaRouterModuleInterface
class MediaRouter : public MediaRouteInterface, public ocst::MediaRouterModuleInterface
{
public:
static std::shared_ptr<MediaRouter> Create();
Expand All @@ -41,7 +41,7 @@ class MediaRouter : public MediaRouteInterface, public OrchestratorMediaRouterMo
bool Stop();

//--------------------------------------------------------------------
// Implementation of OrchestratorModuleInterface
// Implementation of ModuleInterface
//--------------------------------------------------------------------
bool OnCreateApplication(const info::Application &app_info) override;
bool OnDeleteApplication(const info::Application &app_info) override;
Expand Down
4 changes: 2 additions & 2 deletions src/projects/modules/http_server/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bool HttpServer::Start(const ov::SocketAddress &address)
return false;
}

_physical_port = PhysicalPortManager::Instance()->CreatePort(ov::SocketType::Tcp, address);
_physical_port = PhysicalPortManager::GetInstance()->CreatePort(ov::SocketType::Tcp, address);

if (_physical_port != nullptr)
{
Expand All @@ -42,7 +42,7 @@ bool HttpServer::Stop()
if (_physical_port != nullptr)
{
_physical_port->RemoveObserver(this);
PhysicalPortManager::Instance()->DeletePort(_physical_port);
PhysicalPortManager::GetInstance()->DeletePort(_physical_port);
_physical_port = nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion src/projects/modules/http_server/https_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// Backward compatibility
#define HTTP_BACKWARD_COMPATIBILITY "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP"

void HttpsServer::SetVirtualHostList(std::vector<std::shared_ptr<Orchestrator::VirtualHost>>& vhost_list)
void HttpsServer::SetVirtualHostList(std::vector<std::shared_ptr<ocst::VirtualHost>>& vhost_list)
{
_virtual_host_list = vhost_list;
}
Expand Down
4 changes: 2 additions & 2 deletions src/projects/modules/http_server/https_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class HttpsServer : public HttpServer
{
public:
void SetVirtualHostList(std::vector<std::shared_ptr<Orchestrator::VirtualHost>>& vhost_list);
void SetVirtualHostList(std::vector<std::shared_ptr<ocst::VirtualHost>>& vhost_list);

protected:
//--------------------------------------------------------------------
Expand All @@ -25,5 +25,5 @@ class HttpsServer : public HttpServer
void OnDataReceived(const std::shared_ptr<ov::Socket> &remote, const ov::SocketAddress &address, const std::shared_ptr<const ov::Data> &data) override;

protected:
std::vector<std::shared_ptr<Orchestrator::VirtualHost>> _virtual_host_list;
std::vector<std::shared_ptr<ocst::VirtualHost>> _virtual_host_list;
};
6 changes: 3 additions & 3 deletions src/projects/modules/ice/ice_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const std::vector<RtcIceCandidate> &IcePort::GetIceCandidateList() const

std::shared_ptr<PhysicalPort> IcePort::CreatePhysicalPort(const ov::SocketAddress &address, ov::SocketType type)
{
auto physical_port = PhysicalPortManager::Instance()->CreatePort(type, address);
auto physical_port = PhysicalPortManager::GetInstance()->CreatePort(type, address);

if (physical_port != nullptr)
{
Expand All @@ -120,7 +120,7 @@ std::shared_ptr<PhysicalPort> IcePort::CreatePhysicalPort(const ov::SocketAddres

logte("Cannot add a observer %p to %p", this, physical_port.get());

PhysicalPortManager::Instance()->DeletePort(physical_port);
PhysicalPortManager::GetInstance()->DeletePort(physical_port);
}
else
{
Expand All @@ -139,7 +139,7 @@ bool IcePort::Close()
for (auto &physical_port : _physical_port_list)
{
result = result && physical_port->RemoveObserver(this);
result = result && PhysicalPortManager::Instance()->DeletePort(physical_port);
result = result && PhysicalPortManager::GetInstance()->DeletePort(physical_port);

if (result == false)
{
Expand Down
4 changes: 2 additions & 2 deletions src/projects/modules/rtc_signalling/rtc_signalling_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool RtcSignallingServer::Start(const ov::SocketAddress *address, const ov::Sock
// TLS is enabled
_https_server = std::make_shared<HttpsServer>();

auto vhost_list = Orchestrator::GetInstance()->GetVirtualHostList();
auto vhost_list = ocst::Orchestrator::GetInstance()->GetVirtualHostList();
_https_server->SetVirtualHostList(vhost_list);
}
else
Expand Down Expand Up @@ -112,7 +112,7 @@ bool RtcSignallingServer::InitializeWebSocketServer()
auto &app_name = tokens[1];
auto &stream_name = tokens[2];

info::VHostAppName vhost_app_name = Orchestrator::GetInstance()->ResolveApplicationNameFromDomain(host_name, tokens[1]);
info::VHostAppName vhost_app_name = ocst::Orchestrator::GetInstance()->ResolveApplicationNameFromDomain(host_name, tokens[1]);

auto info = std::make_shared<RtcSignallingInfo>(vhost_app_name, host_name, app_name, stream_name);

Expand Down
6 changes: 6 additions & 0 deletions src/projects/orchestrator/AMS.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ include $(DEFAULT_VARIABLES)

LOCAL_TARGET := orchestrator

LOCAL_SOURCE_FILES := $(LOCAL_SOURCE_FILES) \
$(call get_sub_source_list,data_structures) \

LOCAL_HEADER_FILES := $(LOCAL_HEADER_FILES) \
$(call get_sub_header_list,data_structures) \

$(call add_pkg_config,openssl)
$(call add_pkg_config,srt)

Expand Down
Loading

0 comments on commit d8e8fcc

Please sign in to comment.