forked from espressif/esp-modbus
modbus master tcp port: fix to close sockets correctly, minor additions for the PR
https://github.com/espressif/esp-modbus/pull/44
This commit is contained in:
@@ -236,7 +236,6 @@ static BOOL xMBTCPPortMasterCloseConnection(MbSlaveInfo_t *pxInfo)
|
||||
static void xMBTCPPortMasterShutdown(void)
|
||||
{
|
||||
xSemaphoreGive(xShutdownSema);
|
||||
xMbPortConfig.xMbTcpTaskHandle = NULL;
|
||||
|
||||
for (USHORT ucCnt = 0; ucCnt < MB_TCP_PORT_MAX_CONN; ucCnt++) {
|
||||
MbSlaveInfo_t* pxInfo = xMbPortConfig.pxMbSlaveInfo[ucCnt];
|
||||
@@ -251,6 +250,7 @@ static void xMBTCPPortMasterShutdown(void)
|
||||
}
|
||||
free(xMbPortConfig.pxMbSlaveInfo);
|
||||
vTaskDelete(NULL);
|
||||
xMbPortConfig.xMbTcpTaskHandle = NULL;
|
||||
}
|
||||
|
||||
void vMBTCPPortMasterSetNetOpt(void *pvNetIf, eMBPortIpVer xIpVersion, eMBPortProto xProto)
|
||||
@@ -754,7 +754,8 @@ static void vMBTCPPortMasterTask(void *pvParameters)
|
||||
break;
|
||||
}
|
||||
putchar(ucDot);
|
||||
vTaskDelay(pdMS_TO_TICKS(100)); /* if we don't yield we run the risk of hogging CPU */
|
||||
// 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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user