Skip to content

Commit 72577a9

Browse files
committed
fixed:configure parse failed
fixed:report info not time count
1 parent 94297f8 commit 72577a9

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,12 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
6161
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_OPENFILE;
6262
return false;
6363
}
64-
size_t nCount = 0;
65-
XCHAR tszMsgBuffer[4096];
66-
while (1)
67-
{
68-
size_t nRet = fread(tszMsgBuffer + nCount, 1, 2048, pSt_File);
69-
if (nRet <= 0)
70-
{
71-
break;
72-
}
73-
nCount += nRet;
74-
}
64+
XCHAR tszMsgBuffer[8192] = {};
65+
size_t nRet = fread(tszMsgBuffer, 1, sizeof(tszMsgBuffer), pSt_File);
7566
fclose(pSt_File);
7667
//开始解析配置文件
7768
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_JsonBuilder.newCharReader());
78-
if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nCount, &st_JsonRoot, &st_JsonError))
69+
if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nRet, &st_JsonRoot, &st_JsonError))
7970
{
8071
Config_IsErrorOccur = true;
8172
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_PARSE;
@@ -84,7 +75,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
8475
_tcsxcpy(pSt_ServerConfig->tszSMSUrl, st_JsonRoot["tszSMSUrl"].asCString());
8576
_tcsxcpy(pSt_ServerConfig->tszIPAddr, st_JsonRoot["tszIPAddr"].asCString());
8677
pSt_ServerConfig->bDeamon = st_JsonRoot["bDeamon"].asInt();
87-
8878
pSt_ServerConfig->nRTMPPort = st_JsonRoot["nRTMPPort"].asInt();
8979
pSt_ServerConfig->nHttpPort = st_JsonRoot["nHttpPort"].asInt();
9080
pSt_ServerConfig->nXStreamPort = st_JsonRoot["nXStreamPort"].asInt();
@@ -137,7 +127,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
137127
Json::Value st_PullWebRtc = st_Pull["RTC"];
138128
Json::Value st_PullSrt = st_Pull["SRT"];
139129
Json::Value st_PullTs = st_Pull["TS"];
140-
141130
pSt_ServerConfig->st_XPull.st_PullXStream.bEnable = st_PullXStream["bEnable"].asBool();
142131
pSt_ServerConfig->st_XPull.st_PullXStream.bPrePull = st_PullXStream["bPrePull"].asBool();
143132

XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_Configure.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ bool XEngine_Configure_Parament(int argc, char** argv)
1414
{
1515
LPCXSTR lpszServiceCfg = _X("./XEngine_Config/XEngine_Config.json");
1616
LPCXSTR lpszServiceVersion = _X("./XEngine_Config/XEngine_Version.json");
17-
1817
if (!ModuleConfigure_Json_File(lpszServiceCfg, &st_ServiceConfig))
1918
{
2019
printf("解析配置文件失败,ModuleConfigure_Json_File:%lX", ModuleConfigure_GetLastError());

XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ int main(int argc, char** argv)
625625
if (st_ServiceConfig.st_XReport.bEnable && !bIsTest)
626626
{
627627
__int64x nTimeCount = 0;
628-
if (InfoReport_APIMachine_Send(st_ServiceConfig.st_XReport.tszAPIUrl, st_ServiceConfig.st_XReport.tszServiceName))
628+
if (InfoReport_APIMachine_Send(st_ServiceConfig.st_XReport.tszAPIUrl, st_ServiceConfig.st_XReport.tszServiceName, &nTimeCount))
629629
{
630630
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,启动信息报告给API服务器:%s 成功,报告次数:%lld"), st_ServiceConfig.st_XReport.tszAPIUrl, nTimeCount);
631631
}

0 commit comments

Comments
 (0)