From 3fa3f1e46d38071b33434a684ea4312243574376 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 3 May 2017 00:12:51 +0800 Subject: [PATCH] update --- CMakeLists.txt | 4 +--- tests/test_server.cpp | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d059900..caae6ef5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,9 +78,7 @@ add_definitions(-DENABLE_RTMP2RTSP -DENABLE_RTSP2RTMP -DENABLE_HLS) include_directories(${PROJECT_SOURCE_DIR}/src) #使能c++11 -if(CMAKE_COMPILER_IS_GNUCXX) - add_compile_options(-std=c++11) -endif(CMAKE_COMPILER_IS_GNUCXX) +set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") #关闭过期接口警告 add_compile_options(-Wno-deprecated-declarations) diff --git a/tests/test_server.cpp b/tests/test_server.cpp index 7a5f08ef..282730b5 100644 --- a/tests/test_server.cpp +++ b/tests/test_server.cpp @@ -12,9 +12,12 @@ #include "Rtsp/RtspSession.h" #include "Rtmp/RtmpSession.h" #include "Http/HttpSession.h" -#include "Http/HttpsSession.h" + +#ifdef ENABLE_OPENSSL #include "Util/SSLBox.h" -#include "Util/SqlPool.h" +#include "Http/HttpsSession.h" +#endif//ENABLE_OPENSSL + #include "Util/logger.h" #include "Util/onceToken.h" #include "Util/File.h" @@ -50,6 +53,8 @@ int main(int argc,char *argv[]){ player->play(url); proxyMap.emplace(string(url),player); } + +#ifdef ENABLE_OPENSSL //请把证书"test_server.pem"放置在本程序可执行程序同目录下 try{ SSL_Initor::Instance().loadServerPem((exePath() + ".pem").data()); @@ -57,22 +62,32 @@ int main(int argc,char *argv[]){ FatalL << "请把证书:" << (exeName() + ".pem") << "放置在本程序可执行程序同目录下:" << exeDir() << endl; return 0; } +#endif //ENABLE_OPENSSL TcpServer::Ptr rtspSrv(new TcpServer()); TcpServer::Ptr rtmpSrv(new TcpServer()); TcpServer::Ptr httpSrv(new TcpServer()); - TcpServer::Ptr httpsSrv(new TcpServer()); + rtspSrv->start(mINI::Instance()[Config::Rtsp::kPort]); rtmpSrv->start(mINI::Instance()[Config::Rtmp::kPort]); httpSrv->start(mINI::Instance()[Config::Http::kPort]); + + +#ifdef ENABLE_OPENSSL + TcpServer::Ptr httpsSrv(new TcpServer()); httpsSrv->start(mINI::Instance()[Config::Http::kSSLPort]); +#endif //ENABLE_OPENSSL + EventPoller::Instance().runLoop(); rtspSrv.reset(); rtmpSrv.reset(); httpSrv.reset(); + +#ifdef ENABLE_OPENSSL httpsSrv.reset(); +#endif //ENABLE_OPENSSL UDPServer::Destory(); WorkThreadPool::Destory();