Skip to content

Commit a1c827d

Browse files
committed
fixed:copy file error on mac
added:test start command support
1 parent 6f1032a commit a1c827d

File tree

5 files changed

+48
-30
lines changed

5 files changed

+48
-30
lines changed

XEngine_Source/MQCore_ConfigModule/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pch.o:./pch.cpp
5959

6060
InstallAll:InstallSo
6161
InstallSo:./libMQCore_ConfigModule.$(FILEEXT)
62-
cp ./libMQCore_ConfigModule.so ../../XEngine_Release/libMQCore_ConfigModule.$(FILEEXT)
62+
cp ./libMQCore_ConfigModule.$(FILEEXT) ../../XEngine_Release/libMQCore_ConfigModule.$(FILEEXT)
6363

6464

6565
CleanAll:CleanObj CleanMk

XEngine_Source/MQCore_DBModule/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pch.o:./pch.cpp
6161

6262
InstallAll:InstallSo
6363
InstallSo:./libMQCore_DBModule.$(FILEEXT)
64-
cp ./libMQCore_DBModule.so ../../XEngine_Release/libMQCore_DBModule.$(FILEEXT)
64+
cp ./libMQCore_DBModule.$(FILEEXT) ../../XEngine_Release/libMQCore_DBModule.$(FILEEXT)
6565

6666

6767
CleanAll:CleanObj CleanMk

XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bool MQ_Service_Parament(int argc, char** argv, XENGINE_SERVERCONFIG* pSt_Startl
2323
MQ_Service_ParamentHelp();
2424
return false;
2525
}
26-
if ((0 == _tcsxcmp("-v",argv[i])) || (0 == _tcsxcmp("-V",argv[i])))
26+
else if ((0 == _tcsxcmp("-v",argv[i])) || (0 == _tcsxcmp("-V",argv[i])))
2727
{
2828
printf("Version:V1.1.0\n");
2929
return false;
@@ -40,6 +40,10 @@ bool MQ_Service_Parament(int argc, char** argv, XENGINE_SERVERCONFIG* pSt_Startl
4040
{
4141
pSt_StartlParam->bDeamon = _ttxoi(argv[i + 1]);
4242
}
43+
else if (0 == _tcsxcmp("-t", argv[i]))
44+
{
45+
bIsTest = true;
46+
}
4347
}
4448

4549
return true;

XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ typedef std::string tstring;
6060
#include "../MQCore_ProtocolModule/Protocol_Error.h"
6161

6262
extern bool bIsRun;
63+
extern bool bIsTest;
6364
extern XHANDLE xhLog;
6465
extern XHANDLE xhTCPSocket;
6566
extern XHANDLE xhHTTPSocket;

XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "MQService_Hdr.h"
22

3-
bool bIsRun = false;
3+
bool bIsRun = true;
4+
bool bIsTest = false;
45
XHANDLE xhLog = NULL;
56
XHANDLE xhTCPSocket = NULL;
67
XHANDLE xhHTTPSocket = NULL;
@@ -90,7 +91,6 @@ int main(int argc, char** argv)
9091
WSADATA st_WSAData;
9192
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
9293
#endif
93-
bIsRun = true;
9494
LPCXSTR lpszHTTPMime = _X("./XEngine_Config/HttpMime.types");
9595
LPCXSTR lpszHTTPCode = _X("./XEngine_Config/HttpCode.types");
9696
LPCXSTR lpszDBConfig = _X("./XEngine_Config/XEngine_DBConfig.json");
@@ -354,40 +354,53 @@ int main(int argc, char** argv)
354354

355355
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("所有服务成功启动,服务运行中,XEngine版本:%s%s,发行版本次数:%d,当前运行版本:%s。。。"), BaseLib_OperatorVer_XNumberStr(), BaseLib_OperatorVer_XTypeStr(), st_ServiceCfg.st_XVer.pStl_ListStorage->size(), st_ServiceCfg.st_XVer.pStl_ListStorage->front().c_str());
356356

357-
while (true)
357+
bIsTest = true;
358+
while (bIsRun)
358359
{
360+
if (bIsTest)
361+
{
362+
goto NETSERVICEEXIT;
363+
}
359364
std::this_thread::sleep_for(std::chrono::seconds(1));
360365
}
361366
NETSERVICEEXIT:
362367

363-
if (bIsRun)
368+
bIsRun = false;
369+
if (bIsTest)
364370
{
365-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("有服务启动失败,服务器退出..."));
366-
bIsRun = false;
367-
368-
HelpComponents_Datas_Destory(xhTCPPacket);
369-
HttpProtocol_Server_DestroyEx(xhHTTPPacket);
370-
RfcComponents_WSPacket_DestoryEx(xhWSPacket);
371-
MQTTProtocol_Parse_Destory();
372-
373-
NetCore_TCPXCore_DestroyEx(xhTCPSocket);
374-
NetCore_TCPXCore_DestroyEx(xhHTTPSocket);
375-
NetCore_TCPXCore_DestroyEx(xhWSSocket);
376-
NetCore_TCPXCore_DestroyEx(xhMQTTSocket);
377-
378-
ManagePool_Thread_NQDestroy(xhTCPPool);
379-
ManagePool_Thread_NQDestroy(xhHttpPool);
380-
ManagePool_Thread_NQDestroy(xhWSPool);
381-
ManagePool_Thread_NQDestroy(xhMQTTPool);
382-
383-
DBModule_MQData_Destory();
384-
DBModule_MQUser_Destory();
385-
386-
SessionModule_Client_Destory();
387-
HelpComponents_XLog_Destroy(xhLog);
371+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("服务启动完毕,测试程序退出..."));
372+
}
373+
else
374+
{
375+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("服务启动失败,服务器退出..."));
388376
}
377+
HelpComponents_Datas_Destory(xhTCPPacket);
378+
HttpProtocol_Server_DestroyEx(xhHTTPPacket);
379+
RfcComponents_WSPacket_DestoryEx(xhWSPacket);
380+
MQTTProtocol_Parse_Destory();
381+
382+
NetCore_TCPXCore_DestroyEx(xhTCPSocket);
383+
NetCore_TCPXCore_DestroyEx(xhHTTPSocket);
384+
NetCore_TCPXCore_DestroyEx(xhWSSocket);
385+
NetCore_TCPXCore_DestroyEx(xhMQTTSocket);
386+
387+
ManagePool_Thread_NQDestroy(xhTCPPool);
388+
ManagePool_Thread_NQDestroy(xhHttpPool);
389+
ManagePool_Thread_NQDestroy(xhWSPool);
390+
ManagePool_Thread_NQDestroy(xhMQTTPool);
391+
392+
DBModule_MQData_Destory();
393+
DBModule_MQUser_Destory();
394+
395+
SessionModule_Client_Destory();
396+
HelpComponents_XLog_Destroy(xhLog);
389397
#ifdef _WINDOWS
390398
WSACleanup();
391399
#endif
400+
401+
if (bIsTest)
402+
{
403+
return -1;
404+
}
392405
return 0;
393406
}

0 commit comments

Comments
 (0)