Merge branch 'bugfix/udp_sync_no_clear' into 'master'

Fix UDP sync no clear cache when close socket.

See merge request sdk/ESP8266_RTOS_SDK!523
This commit is contained in:
Dong Heng
2018-09-27 09:33:24 +08:00
4 changed files with 40 additions and 1 deletions

View File

@ -757,6 +757,10 @@ int lwip_close(int s)
{
int ret;
#if ESP_UDP && LWIP_NETIF_TX_SINGLE_PBUF
udp_sync_close(s);
#endif
_sock_set_open(s, 0);
lwip_sync_mt(s, SHUT_RDWR);

View File

@ -629,6 +629,12 @@ lwip_close(int s)
lwip_socket_drop_registered_memberships(s);
#endif /* LWIP_IGMP */
#ifndef SOCKETS_MT
#if ESP_UDP && LWIP_NETIF_TX_SINGLE_PBUF
udp_sync_close(s);
#endif
#endif
err = netconn_delete(sock->conn);
if (err != ERR_OK) {
sock_set_errno(sock, err_to_errno(err));

View File

@ -195,7 +195,31 @@ void udp_sync_trigger(void)
if (!s_udp_sync_num)
return ;
tcpip_callback_with_block((tcpip_callback_fn)udp_sync_trigger_null, NULL, 0);
tcpip_callback_with_block(udp_sync_trigger_null, NULL, 0);
}
/*
* @brief close and clear the udp sync
*/
static void udp_sync_do_close(void *p)
{
int s = (int)p;
if (s_udp_sync[s].msg) {
ESP_LOGD(TAG, "UDP sync close socket %d", s);
s_udp_sync[s].msg = NULL;
s_udp_sync[s].retry = 0;
s_udp_sync[s].ret = ERR_OK;
s_udp_sync_num--;
}
}
/**
* @brief close the udp sync before close the socket
*/
void udp_sync_close(int s)
{
tcpip_callback_with_block(udp_sync_do_close, (void *)s, 1);
}
#endif /* ESP_UDP */

View File

@ -57,6 +57,11 @@ void udp_sync_proc(void);
*/
void udp_sync_trigger(void);
/**
* @brief close the udp sync before close the socket
*/
void udp_sync_close(int s);
#ifdef __cplusplus
}
#endif