Skip to content

Commit adcac75

Browse files
committed
fixed:unread protocol memory leak
fixed:unread protocol serial handle is incorrent
1 parent 450f271 commit adcac75

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

XEngine_Source/MQCore_DBModule/DBModule_MQData/DBModule_MQData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ bool CDBModule_MQData::DBModule_MQData_List(LPCXSTR lpszQueueName, __int64x nSer
304304
XCHAR tszSQLStatement[1024];
305305
memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
306306
//名称为,消息名为必填
307-
_xstprintf(tszSQLStatement, _X("SELECT * FROM `%s` WHERE nQueueSerial > %lld"), lpszQueueName, nSerial);
307+
_xstprintf(tszSQLStatement, _X("SELECT * FROM `%s` WHERE nQueueSerial >= %lld"), lpszQueueName, nSerial);
308308
if (!DataBase_MySQL_ExecuteQuery(xhDBSQL, &xhTable, tszSQLStatement, &nllLine, &nllRow))
309309
{
310310
DBModule_IsErrorOccur = true;

XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,14 +854,16 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC
854854
if (nDBCount > 0)
855855
{
856856
//更新用户KEY
857-
st_UserKey.nKeySerial = ppSt_UserKey[i]->nKeySerial + nDBCount + 1;
857+
st_UserKey.nKeySerial = ppSt_UserKey[i]->nKeySerial + nDBCount;
858858
_tcsxcpy(st_UserKey.tszUserName, tszUserName);
859859
_tcsxcpy(st_UserKey.tszKeyName, ppSt_UserKey[i]->tszKeyName);
860860
DBModule_MQUser_KeyUPDate(&st_UserKey);
861861
ProtocolModule_Packet_UNReadInsert(xhUNRead, &ppSt_DBMessage, nDBCount);
862+
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_DBMessage, nDBCount);
862863
}
863864
}
864865
ProtocolModule_Packet_UNReadDelete(xhUNRead, tszSDBuffer, &nSDLen);
866+
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_UserKey, nListCount);
865867
XEngine_MQXService_Send(lpszClientAddr, tszSDBuffer, nSDLen, nNetType);
866868
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("%s消息端:%s,请求未读消息成功,用户名:%s,发送未读消息成功,发送的主题个数:%d"), lpszClientType, lpszClientAddr, tszUserName, nListCount);
867869
}

XEngine_Source/XQueue_ProtocolHdr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
typedef struct
5757
{
5858
XBYTE byAttrAll : 1; //通知所有
59-
XBYTE byAttrDisk : 1; //消息存储标记
59+
XBYTE byAttrSelf : 1; //自己也能接受
6060
XBYTE byAttrResver2 : 1;
6161
XBYTE byAttrResver3 : 1;
6262
XBYTE byAttrResver4 : 1;

0 commit comments

Comments
 (0)