Merge branch 'bugfix/fix_tcp_master_close_sockets' into 'master'

fix for closing tcp connections and watchdog timeout

Closes IDFGH-11539 and IDFGH-11690

See merge request idf/esp-modbus!53
This commit is contained in:
Alex Lisitsyn
2023-12-22 17:07:33 +08:00

View File

@@ -236,8 +236,6 @@ static BOOL xMBTCPPortMasterCloseConnection(MbSlaveInfo_t *pxInfo)
static void xMBTCPPortMasterShutdown(void)
{
xSemaphoreGive(xShutdownSema);
vTaskDelete(NULL);
xMbPortConfig.xMbTcpTaskHandle = NULL;
for (USHORT ucCnt = 0; ucCnt < MB_TCP_PORT_MAX_CONN; ucCnt++) {
MbSlaveInfo_t* pxInfo = xMbPortConfig.pxMbSlaveInfo[ucCnt];
@@ -251,6 +249,8 @@ static void xMBTCPPortMasterShutdown(void)
}
}
free(xMbPortConfig.pxMbSlaveInfo);
vTaskDelete(NULL);
xMbPortConfig.xMbTcpTaskHandle = NULL;
}
void vMBTCPPortMasterSetNetOpt(void *pvNetIf, eMBPortIpVer xIpVersion, eMBPortProto xProto)
@@ -754,6 +754,8 @@ static void vMBTCPPortMasterTask(void *pvParameters)
break;
}
putchar(ucDot);
// if we don't yield we run the risk of hogging CPU
vTaskDelay(pdMS_TO_TICKS(MB_TCP_CONNECTION_TIMEOUT_MS));
xErr = xMBTCPPortMasterConnect(pxInfo);
switch(xErr)
{