|
|
|
@ -14,7 +14,16 @@
|
|
|
|
|
#include "udpping.h"
|
|
|
|
|
#include "tcphost.h"
|
|
|
|
|
#include "netport.h"
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
#include <winsock.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#endif
|
|
|
|
|
//#include "..\confrwlib\confrw.h"
|
|
|
|
|
|
|
|
|
|
#define MAX_STRING_LEN 512
|
|
|
|
@ -658,7 +667,7 @@ void ReadPortConfigInfo(u_short netport)
|
|
|
|
|
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d... ...\n", sm.wDay, sm.wHour,
|
|
|
|
|
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szbuf);
|
|
|
|
|
#elif _OS_WINDOWS_DEBUG_
|
|
|
|
|
#elif _DEBUG
|
|
|
|
|
printf("初始化端口%d... ...\n", i+1);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -2375,8 +2384,6 @@ void BaohuLibMain(int netportnum)
|
|
|
|
|
int msec, tmp1, tmp2;
|
|
|
|
|
static int systimecnt = 0;
|
|
|
|
|
|
|
|
|
|
SYSTEMTIME stm;
|
|
|
|
|
|
|
|
|
|
if (InitBaohuLibMainFlag == 0)
|
|
|
|
|
{
|
|
|
|
|
systimecnt = 0;
|
|
|
|
@ -2392,15 +2399,15 @@ void BaohuLibMain(int netportnum)
|
|
|
|
|
|
|
|
|
|
//msec = (msec + TIMER_CNT) % 1000;
|
|
|
|
|
|
|
|
|
|
GetLocalTime(&stm);
|
|
|
|
|
struct tm* ptm = localtime(NULL);
|
|
|
|
|
|
|
|
|
|
DayTime.Year = stm.wYear;
|
|
|
|
|
DayTime.Month = (stm.wMonth & 0xff);
|
|
|
|
|
DayTime.Day = (stm.wDay & 0xff);
|
|
|
|
|
DayTime.Hour = stm.wHour & 0xff;
|
|
|
|
|
DayTime.Min = stm.wMinute & 0xff;
|
|
|
|
|
DayTime.Sec = stm.wSecond & 0xff;
|
|
|
|
|
DayTime.mSec = stm.wMilliseconds;
|
|
|
|
|
DayTime.Year = ptm->tm_year + 1900;
|
|
|
|
|
DayTime.Month = ptm->tm_mon + 1;
|
|
|
|
|
DayTime.Day = ptm->tm_mday;
|
|
|
|
|
DayTime.Hour = ptm->tm_hour;
|
|
|
|
|
DayTime.Min = ptm->tm_min;
|
|
|
|
|
DayTime.Sec = ptm->tm_sec;
|
|
|
|
|
DayTime.mSec = 0;
|
|
|
|
|
Sleep(100);
|
|
|
|
|
// 网络端口写
|
|
|
|
|
//SetUdpRecv();
|
|
|
|
@ -2419,9 +2426,9 @@ void BaohuLibMain(int netportnum)
|
|
|
|
|
//CreatUdpSetSock();
|
|
|
|
|
OpenAllPort();
|
|
|
|
|
|
|
|
|
|
if (stm.wSecond == 0)
|
|
|
|
|
if (ptm->tm_sec == 0)
|
|
|
|
|
{
|
|
|
|
|
tmp2 = stm.wMinute * 60;
|
|
|
|
|
tmp2 = ptm->tm_min * 60;
|
|
|
|
|
tmp1 = tmp2 - systimecnt;
|
|
|
|
|
if (tmp1 < 0)
|
|
|
|
|
tmp1 += 3600;
|
|
|
|
@ -2913,25 +2920,31 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
//SioParam[commid].PortType = PROTOCOL_MASTER;
|
|
|
|
|
if (pBaohuParam->AiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(aiptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->AiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->AiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->DiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(diptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->DiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->DiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->PiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(piptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->PiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->PiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2947,9 +2960,11 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d aiptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(AI_DEF)*pBaohuParam->AiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->AiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2971,9 +2986,11 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d diptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(DI_DEF)*pBaohuParam->DiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->DiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2996,9 +3013,11 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d piptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid, sizeof(PI_DEF)*pBaohuParam->PiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo + 1);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->PiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3099,9 +3118,11 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
case PROTOCOL_SLAVE:
|
|
|
|
|
if ((ProvPortCnt+1) > MAX_PROV_PORT_NUM)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "WARN(%04d): commid_%02d is error, the Prov Port is over !!!\n",
|
|
|
|
|
_getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ProvPortCnt++;
|
|
|
|
@ -3109,33 +3130,41 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->AiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(aiptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->AiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->AiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->DiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(diptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->DiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->DiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->PiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(piptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->PiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->PiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(pBaohuParam->ProvSoeBuf.ptrProvSoe)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(soeptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->ProvSoeBuf.ptrProvSoe);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->ProvSoeBuf.ptrProvSoe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3151,9 +3180,11 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d aiptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(PROV_AI_PNT)*pBaohuParam->AiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->AiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3174,9 +3205,11 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d diptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(PROV_DI_PNT)*pBaohuParam->DiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->DiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3189,9 +3222,11 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d soeptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(SOE_DEF)*MAX_PROV_SOE);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -3212,9 +3247,11 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d piptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(PROV_PI_PNT)*pBaohuParam->PiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->PiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3437,25 +3474,31 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
//SioParam[commid].PortType = PROTOCOL_MASTER;
|
|
|
|
|
if (pBaohuParam->AiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(aiptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->AiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->AiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->DiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(diptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->DiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->DiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->PiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(piptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->PiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->PiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3471,9 +3514,11 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d aiptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(AI_DEF)*pBaohuParam->AiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->AiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3495,9 +3540,11 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d diptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(DI_DEF)*pBaohuParam->DiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->DiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3520,9 +3567,11 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d piptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(PI_DEF)*pBaohuParam->PiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->PiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3536,42 +3585,52 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
case PROTOCOL_SLAVE:
|
|
|
|
|
if ((ProvPortCnt+1) > MAX_PROV_PORT_NUM)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "WARN(%04d): commid_%02d is error, the Prov Port is over !!!\n",
|
|
|
|
|
_getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ProvPortCnt++;
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->AiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(aiptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->AiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->AiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->DiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(diptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->DiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->DiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pBaohuParam->PiPtr)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(piptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->PiPtr);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->PiPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(pBaohuParam->ProvSoeBuf.ptrProvSoe)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free(soeptr=0x%08x).\n",
|
|
|
|
|
_getpid(), commid + 1, pBaohuParam->ProvSoeBuf.ptrProvSoe);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
free(pBaohuParam->ProvSoeBuf.ptrProvSoe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3587,9 +3646,11 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d aiptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(PROV_AI_PNT)*pBaohuParam->AiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->AiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3610,9 +3671,11 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d diptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(PROV_DI_PNT)*pBaohuParam->DiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->DiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3625,9 +3688,11 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d soeptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(SOE_DEF)*MAX_PROV_SOE);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -3648,9 +3713,11 @@ void PortMemoryMallocEx(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "ERR_(%04d): commid_%02d piptr=malloc(%d) is failed.\n",
|
|
|
|
|
_getpid(), commid + 1, sizeof(PROV_PI_PNT)*pBaohuParam->PiNum);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
pBaohuParam->PiNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -4009,41 +4076,53 @@ void PortMemoryFree(int commid, SIO_PARAM_DEF *pGenParam)
|
|
|
|
|
if (pGenParam->m_psBaoHu->AiPtr)
|
|
|
|
|
{
|
|
|
|
|
free(pGenParam->m_psBaoHu->AiPtr);
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free ai memory.\n", _getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pGenParam->m_psBaoHu->DiPtr)
|
|
|
|
|
{
|
|
|
|
|
free(pGenParam->m_psBaoHu->DiPtr);
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free di memory.\n", _getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pGenParam->m_psBaoHu->PiPtr)
|
|
|
|
|
{
|
|
|
|
|
free(pGenParam->m_psBaoHu->PiPtr);
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free pi memory.\n", _getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(pGenParam->m_psBaoHu->ProvSoeBuf.ptrProvSoe)
|
|
|
|
|
{
|
|
|
|
|
free(pGenParam->m_psBaoHu->ProvSoeBuf.ptrProvSoe);
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free ProvSoe memory.\n", _getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(pGenParam->m_psBaoHu);
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free psBaohu memory.\n", _getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pGenParam->m_psSerial)
|
|
|
|
|
{
|
|
|
|
|
free(pGenParam->m_psSerial);
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free psSerial memory.\n", _getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pGenParam->ExtInfo)
|
|
|
|
@ -4052,14 +4131,18 @@ void PortMemoryFree(int commid, SIO_PARAM_DEF *pGenParam)
|
|
|
|
|
if (FunCallPtr[SioParam[commid].ProtocolIdx].ProtocolExit)
|
|
|
|
|
{
|
|
|
|
|
FunCallPtr[SioParam[commid].ProtocolIdx].ProtocolExit(commid);
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d Protocol Exit.\n", _getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HEAP_FREE(pGenParam->ExtInfo);
|
|
|
|
|
//free(pGenParam->ExtInfo);
|
|
|
|
|
#ifdef _OS_WINDOWS_DEBUG_
|
|
|
|
|
sprintf(szDebugInfo, "TIP_(%04d): commid_%02d free ExtInfo memory.\n", _getpid(), commid + 1);
|
|
|
|
|
OutputDebugString((LPCWSTR)szDebugInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PortWriteDataFree(commid);
|
|
|
|
|