@@ -188,10 +188,20 @@ void XEngine_MQXService_Close(LPCXSTR lpszClientAddr, int nIPProto, bool bHeart)
188188 }
189189}
190190// ////////////////////////////////////////////////////////////////////////
191+ // 发送统一出口:
192+ // 1) 根据配置决定是否对业务负载进行对称加密;
193+ // 2) 按客户端网络类型分发到底层发送实现;
194+ // 3) 任一底层发送失败立即返回 false,并记录详细日志。
195+ // 参数说明:
196+ // - lpszClientAddr: 客户端地址/会话标识;
197+ // - lpszMsgBuffer/nMsgLen: 待发送原始消息及长度;
198+ // - nIPProto: 传输协议类型(TCP/HTTP/...);
199+ // - pSt_MSGAttr/lpszUserName: 协议分支使用的附加信息。
191200bool XEngine_MQXService_Send (LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nIPProto, XENGINE_PROTOCOL_MSGATTR * pSt_MSGAttr, LPCXSTR lpszUserName)
192201{
193202 CMQService_MemoryPool m_MQMemoryCodec (XENGINE_MEMORY_SIZE_MAX );
194203
204+ // 统一编码阶段:开启加密时写入加密后的负载;否则复制原始数据。
195205 if (st_ServiceCfg.st_XCryption .bEnable )
196206 {
197207 Cryption_Api_CryptEncodec ((LPCXBTR )lpszMsgBuffer, (XBYTE *)m_MQMemoryCodec.get (), &nMsgLen, st_ServiceCfg.st_XCryption .tszPassword , (ENUM_XENGINE_CRYPTION_SYMMETRIC )st_ServiceCfg.st_XCryption .nCryptionType );
@@ -201,6 +211,7 @@ bool XEngine_MQXService_Send(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int
201211 memcpy (m_MQMemoryCodec.get (), lpszMsgBuffer, nMsgLen);
202212 }
203213
214+ // TCP 分支:直接通过 TCP 核心发送已编码数据。
204215 if (XENGINE_MQAPP_NETTYPE_TCP == nIPProto)
205216 {
206217 if (!NetCore_TCPXCore_SendEx (xhTCPSocket, lpszClientAddr, m_MQMemoryCodec.get (), nMsgLen))
@@ -209,6 +220,7 @@ bool XEngine_MQXService_Send(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int
209220 return false ;
210221 }
211222 }
223+ // HTTP 分支:进入 HTTP 响应发送流程(使用消息属性构造响应上下文)。
212224 else if (XENGINE_MQAPP_NETTYPE_HTTP == nIPProto)
213225 {
214226 CMQService_MemoryPool m_MQMemoryPool (XENGINE_MEMORY_SIZE_MAX );
0 commit comments