@@ -431,7 +431,6 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC
431431 continue ;
432432 }
433433 nSDLen = 0 ;
434- int nMSGLen = 0 ;
435434 int nClientType = 0 ;
436435 memset (tszSDBuffer, ' \0 ' , sizeof (tszSDBuffer));
437436
@@ -448,29 +447,29 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC
448447 {
449448 int nListCount = 0 ;
450449 XENGINE_DBUSERKEY** ppSt_ListUser;
451- if (DBModule_MQUser_KeyList (NULL , st_MQProtocol.tszMQKey , &ppSt_ListUser, &nListCount))
450+ DBModule_MQUser_KeyList (NULL , st_MQProtocol.tszMQKey , &ppSt_ListUser, &nListCount);
451+
452+ for (int i = 0 ; i < nListCount; i++)
452453 {
453- int nTCPLen = 0 ;
454- XCHAR tszTCPBuffer[4096 ];
455- memset (tszTCPBuffer, ' \0 ' , sizeof (tszTCPBuffer));
456-
457- pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_MSGNOTIFY;
458- ProtocolModule_Packet_Common (nNetType, pSt_ProtocolHdr, &st_MQProtocol, tszTCPBuffer, &nTCPLen, lpszMsgBuffer + sizeof (XENGINE_PROTOCOL_XMQ), nMsgLen - sizeof (XENGINE_PROTOCOL_XMQ));
459- for (int i = 0 ; i < nListCount; i++)
454+ // 跳过自己
455+ if (0 == _tcsxncmp (tszUserName, ppSt_ListUser[i]->tszUserName , _tcsxlen (tszUserName)))
460456 {
461- // 跳过自己
462- if (0 == _tcsxncmp (tszUserName, ppSt_ListUser[i]->tszUserName , _tcsxlen (tszUserName)))
463- {
464- continue ;
465- }
466- XCHAR tszUserAddr[128 ];
467- memset (tszUserAddr, ' \0 ' , sizeof (tszUserAddr));
468-
469- SessionModule_Client_GetAddr (ppSt_ListUser[i]->tszUserName , tszUserAddr);
470- XEngine_MQXService_Send (tszUserAddr, tszTCPBuffer, nTCPLen, nNetType);
457+ continue ;
471458 }
472- BaseLib_OperatorMemory_Free ((XPPPMEM)&ppSt_ListUser, nListCount);
459+ nSDLen = 0 ;
460+ int nClientType = 0 ;
461+ XCHAR tszUserAddr[128 ];
462+ memset (tszUserAddr, ' \0 ' , sizeof (tszUserAddr));
463+ memset (tszSDBuffer, ' \0 ' , sizeof (tszSDBuffer));
464+
465+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_MSGNOTIFY;
466+
467+ SessionModule_Client_GetAddr (ppSt_ListUser[i]->tszUserName , tszUserAddr);
468+ SessionModule_Client_GetType (tszUserAddr, &nClientType);
469+ ProtocolModule_Packet_Common (nClientType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen, lpszMsgBuffer + sizeof (XENGINE_PROTOCOL_XMQ), nMsgLen - sizeof (XENGINE_PROTOCOL_XMQ));
470+ XEngine_MQXService_Send (tszUserAddr, tszSDBuffer, nSDLen, nClientType);
473471 }
472+ BaseLib_OperatorMemory_Free ((XPPPMEM)&ppSt_ListUser, nListCount);
474473 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" %s消息端:%s,主题:%s,序列:%lld,投递数据到消息队列成功,通知客户端个数:%d" ), lpszClientType, lpszClientAddr, st_DBQueue.tszQueueName , st_DBQueue.nQueueSerial , nListCount);
475474 }
476475 }
0 commit comments