精简配置文件

This commit is contained in:
xiongziliang 2018-12-19 17:53:43 +08:00
parent 314c4cfa7a
commit 029fdaeae6
3 changed files with 16 additions and 27 deletions

View File

@ -75,12 +75,6 @@ onceToken token([](){
namespace Http { namespace Http {
#define HTTP_FIELD "http." #define HTTP_FIELD "http."
#define HTTP_PORT 80
const char kPort[] = HTTP_FIELD"port";
#define HTTPS_PORT 443
extern const char kSSLPort[] = HTTP_FIELD"sslport";
//http 文件发送缓存大小 //http 文件发送缓存大小
#define HTTP_SEND_BUF_SIZE (64 * 1024) #define HTTP_SEND_BUF_SIZE (64 * 1024)
const char kSendBufSize[] = HTTP_FIELD"sendBufSize"; const char kSendBufSize[] = HTTP_FIELD"sendBufSize";
@ -123,8 +117,6 @@ const char kNotFound[] = HTTP_FIELD"notFound";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kPort] = HTTP_PORT;
mINI::Instance()[kSSLPort] = HTTPS_PORT;
mINI::Instance()[kSendBufSize] = HTTP_SEND_BUF_SIZE; mINI::Instance()[kSendBufSize] = HTTP_SEND_BUF_SIZE;
mINI::Instance()[kMaxReqSize] = HTTP_MAX_REQ_SIZE; mINI::Instance()[kMaxReqSize] = HTTP_MAX_REQ_SIZE;
mINI::Instance()[kKeepAliveSecond] = HTTP_KEEP_ALIVE_SECOND; mINI::Instance()[kKeepAliveSecond] = HTTP_KEEP_ALIVE_SECOND;
@ -140,14 +132,10 @@ onceToken token([](){
namespace Shell { namespace Shell {
#define SHELL_FIELD "shell." #define SHELL_FIELD "shell."
#define SHELL_PORT 9000
const char kPort[] = SHELL_FIELD"port";
#define SHELL_MAX_REQ_SIZE 1024 #define SHELL_MAX_REQ_SIZE 1024
const char kMaxReqSize[] = SHELL_FIELD"maxReqSize"; const char kMaxReqSize[] = SHELL_FIELD"maxReqSize";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kPort] = SHELL_PORT;
mINI::Instance()[kMaxReqSize] = SHELL_MAX_REQ_SIZE; mINI::Instance()[kMaxReqSize] = SHELL_MAX_REQ_SIZE;
},nullptr); },nullptr);
} //namespace Shell } //namespace Shell
@ -155,14 +143,9 @@ onceToken token([](){
////////////RTSP服务器配置/////////// ////////////RTSP服务器配置///////////
namespace Rtsp { namespace Rtsp {
#define RTSP_FIELD "rtsp." #define RTSP_FIELD "rtsp."
#define RTSP_PORT 554
const char kPort[] = RTSP_FIELD"port";
const char kAuthBasic[] = RTSP_FIELD"authBasic"; const char kAuthBasic[] = RTSP_FIELD"authBasic";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kPort] = RTSP_PORT;
//默认Md5方式认证 //默认Md5方式认证
mINI::Instance()[kAuthBasic] = 0; mINI::Instance()[kAuthBasic] = 0;
},nullptr); },nullptr);
@ -172,13 +155,9 @@ onceToken token([](){
////////////RTMP服务器配置/////////// ////////////RTMP服务器配置///////////
namespace Rtmp { namespace Rtmp {
#define RTMP_FIELD "rtmp." #define RTMP_FIELD "rtmp."
#define RTMP_PORT 1935
const char kPort[] = RTMP_FIELD"port";
const char kModifyStamp[] = RTMP_FIELD"modifyStamp"; const char kModifyStamp[] = RTMP_FIELD"modifyStamp";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kPort] = RTMP_PORT;
mINI::Instance()[kModifyStamp] = true; mINI::Instance()[kModifyStamp] = true;
},nullptr); },nullptr);
} //namespace RTMP } //namespace RTMP

View File

@ -151,8 +151,6 @@ extern const char kBroadcastReloadConfig[];
////////////HTTP配置/////////// ////////////HTTP配置///////////
namespace Http { namespace Http {
extern const char kPort[];
extern const char kSSLPort[];
//http 文件发送缓存大小 //http 文件发送缓存大小
extern const char kSendBufSize[]; extern const char kSendBufSize[];
//http 最大请求字节数 //http 最大请求字节数
@ -173,20 +171,16 @@ extern const char kNotFound[];
////////////SHELL配置/////////// ////////////SHELL配置///////////
namespace Shell { namespace Shell {
extern const char kMaxReqSize[]; extern const char kMaxReqSize[];
extern const char kPort[];
} //namespace Shell } //namespace Shell
////////////RTSP服务器配置/////////// ////////////RTSP服务器配置///////////
namespace Rtsp { namespace Rtsp {
extern const char kPort[];
//是否优先base64方式认证默认Md5方式认证 //是否优先base64方式认证默认Md5方式认证
extern const char kAuthBasic[]; extern const char kAuthBasic[];
} //namespace Rtsp } //namespace Rtsp
////////////RTMP服务器配置/////////// ////////////RTMP服务器配置///////////
namespace Rtmp { namespace Rtmp {
extern const char kPort[];
extern const char kModifyStamp[]; extern const char kModifyStamp[];
} //namespace RTMP } //namespace RTMP

View File

@ -42,6 +42,22 @@ using namespace std;
using namespace toolkit; using namespace toolkit;
using namespace mediakit; using namespace mediakit;
namespace mediakit {
////////////HTTP配置///////////
namespace Http {
#define HTTP_FIELD "http."
#define HTTP_PORT 80
const char kPort[] = HTTP_FIELD"port";
#define HTTPS_PORT 443
extern const char kSSLPort[] = HTTP_FIELD"sslport";
onceToken token1([](){
mINI::Instance()[kPort] = HTTP_PORT;
mINI::Instance()[kSSLPort] = HTTPS_PORT;
},nullptr);
}//namespace Http
} // namespace mediakit
static onceToken s_token([](){ static onceToken s_token([](){
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastHttpRequest,[](BroadcastHttpRequestArgs){ NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastHttpRequest,[](BroadcastHttpRequestArgs){
//const Parser &parser,HttpSession::HttpResponseInvoker &invoker,bool &consumed //const Parser &parser,HttpSession::HttpResponseInvoker &invoker,bool &consumed