@@ -69,6 +69,34 @@ BOOL XEngine_Task_P2p(LPCTSTR lpszFileHash, LPCTSTR lpszClientAddr, RFCCOMPONENT
6969 memset (tszRVBuffer, ' \0 ' , sizeof (tszRVBuffer));
7070 memset (tszMsgBuffer, ' \0 ' , sizeof (tszMsgBuffer));
7171 memset (&st_HDRParam, ' \0 ' , sizeof (RFCCOMPONENTS_HTTP_HDRPARAM));
72+ // 首先判断本机存在不
73+ if (0 != st_ServiceCfg.st_XSql .nSQLType )
74+ {
75+ int nListCount = 0 ;
76+ XSTORAGECORE_DBFILE** pppSt_ListFile;
77+ if (1 == st_ServiceCfg.st_XSql .nSQLType )
78+ {
79+ XStorageSQL_File_FileQuery (&pppSt_ListFile, &nListCount, NULL , NULL , NULL , lpszFileHash);
80+ }
81+ else
82+ {
83+ XStorage_SQLite_FileQuery (&pppSt_ListFile, &nListCount, NULL , NULL , NULL , lpszFileHash);
84+ }
85+ if (nListCount > 0 )
86+ {
87+ st_HDRParam.bIsClose = TRUE ;
88+ st_HDRParam.nHttpCode = 200 ;
89+
90+ _stprintf (pppSt_ListFile[0 ]->tszTableName , _T (" 127.0.0.1" ));
91+ XStorageProtocol_Core_REPQueryFile (tszRVBuffer, &nRVLen, &pppSt_ListFile, nListCount);
92+ BaseLib_OperatorMemory_Free ((XPPPMEM)&pppSt_ListFile, nListCount);
93+
94+ RfcComponents_HttpServer_SendMsgEx (xhCenterHttp, tszMsgBuffer, &nMsgLen, &st_HDRParam, tszRVBuffer, nRVLen);
95+ XEngine_Net_SendMsg (lpszClientAddr, tszMsgBuffer, nMsgLen, STORAGE_NETTYPE_HTTPCENTER);
96+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T (" 广播端:%s,请求文件查询,发现本地拥有此文件.直接返回" ), lpszClientAddr);
97+ return TRUE ;
98+ }
99+ }
72100 // 根据使用模式来操作
73101 if (st_ServiceCfg.st_P2xp .bBroad )
74102 {
0 commit comments