Install http api and hook before starting the service listener (#3149)

We have found that sometimes, when starting zlmediakit, stream push requests may be received before the hook is ready.
This commit is contained in:
chdahuzi 2023-12-20 19:32:49 +08:00 committed by GitHub
parent c7f2f9e883
commit a17b950b21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -346,6 +346,11 @@ int start_main(int argc,char *argv[]) {
uint16_t srtPort = mINI::Instance()[SRT::kPort]; uint16_t srtPort = mINI::Instance()[SRT::kPort];
#endif //defined(ENABLE_SRT) #endif //defined(ENABLE_SRT)
installWebApi();
InfoL << "已启动http api 接口";
installWebHook();
InfoL << "已启动http hook 接口";
try { try {
auto &secret = mINI::Instance()[API::kSecret]; auto &secret = mINI::Instance()[API::kSecret];
if (secret == "035c73f7-bb6b-4889-a715-d9eb2d1925cc" || secret.empty()) { if (secret == "035c73f7-bb6b-4889-a715-d9eb2d1925cc" || secret.empty()) {
@ -403,11 +408,6 @@ int start_main(int argc,char *argv[]) {
return -1; return -1;
} }
installWebApi();
InfoL << "已启动http api 接口";
installWebHook();
InfoL << "已启动http hook 接口";
//设置退出信号处理函数 //设置退出信号处理函数
static semaphore sem; static semaphore sem;
signal(SIGINT, [](int) { signal(SIGINT, [](int) {