提交 f684490f authored 作者: blu's avatar blu

init

上级 bb442395
...@@ -42,19 +42,23 @@ class HttpSrv{ ...@@ -42,19 +42,23 @@ class HttpSrv{
svr.Post("/config", [this](const Request& req, Response& res){ svr.Post("/config", [this](const Request& req, Response& res){
json ret; json ret;
ret["code"] = 0;
ret["msg"] = "ok";
ret["time"] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count(); ret["time"] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
try{ try{
json newConfig = json::parse(req.body); json newConfig;
newConfig["data"] = json::parse(req.body)["data"];
newConfig["lastupdated"] = ret["time"];
LVDB::setLocalConfig(newConfig); LVDB::setLocalConfig(newConfig);
this->config = newConfig; spdlog::info("evmgr new config: {}", newConfig.dump());
ret["code"] = 0;
ret["msg"] = "ok";
// TODO: restart other components // TODO: restart other components
// //
}catch(exception &e) { }catch(exception &e) {
ret.clear(); ret.clear();
ret["code"] = 1; ret["code"] = -1;
ret["msg"] = e.what(); ret["msg"] = e.what();
ret["data"] = req.body;
} }
res.set_content(ret.dump(), "text/json"); res.set_content(ret.dump(), "text/json");
}); });
......
...@@ -234,6 +234,7 @@ private: ...@@ -234,6 +234,7 @@ private:
urlIn = "rtsp://" + user + ":" + passwd + "@" + ipc["addr"].get<string>() + ":" + ipcPort + "/h264/ch1/sub/av_stream"; urlIn = "rtsp://" + user + ":" + passwd + "@" + ipc["addr"].get<string>() + ":" + ipcPort + "/h264/ch1/sub/av_stream";
addr = evpuller["addr"].get<string>(); addr = evpuller["addr"].get<string>();
spdlog::info("evpuller {} connecting to IPC {}", selfId, urlIn);
if(addr == "*" || addr == "0.0.0.0") { if(addr == "*" || addr == "0.0.0.0") {
spdlog::error("evpuller {} invalid addr {} for pub", selfId, evpuller.dump()); spdlog::error("evpuller {} invalid addr {} for pub", selfId, evpuller.dump());
goto togo_sleep_continue; goto togo_sleep_continue;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论