Closed chengshuihang closed 1 year ago
@chengshuihang thanks for reporting the issue, I did a quick check for _nx_dns_reponse_get () function, looks all functions in _nx_dns_response_get() correctly release the packet for error status, could you point us where we need to release the packet? thanks.
UINT _nx_dns_response_get(NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer,
UINT buffer_size, UINT *record_count, ULONG wait_option)
{
UINT status;
NX_PACKET *packet_ptr;
/* Wait for a DNS response. */
status = _nx_dns_response_receive(dns_ptr, &packet_ptr, wait_option);
/* Check status. */
if (status == NX_SUCCESS)
{
#ifndef NX_DISABLE_PACKET_CHAIN
if (packet_ptr -> nx_packet_next)
{
/* Chained packet is not supported. */
nx_packet_release(packet_ptr);
/* Release the resource obtained in _nx_dns_host_resource_data_by_name_get for non-blocking. */
if (wait_option == NX_NO_WAIT)
{
/* Unbind the socket. */
nx_udp_socket_unbind(&(dns_ptr -> nx_dns_socket));
tx_mutex_put(&dns_ptr -> nx_dns_mutex);
}
return(NX_INVALID_PACKET);
}
#endif /* NX_DISABLE_PACKET_CHAIN */
/* Call the function to process the DNS packet. */
status = _nx_dns_response_process(dns_ptr, host_name, packet_ptr, record_buffer, buffer_size, record_count);
}
/* Release the resource obtained in _nx_dns_host_resource_data_by_name_get for non-blocking. */
if (wait_option == NX_NO_WAIT)
{
/* Unbind the socket. */
nx_udp_socket_unbind(&(dns_ptr -> nx_dns_socket));
tx_mutex_put(&dns_ptr -> nx_dns_mutex);
}
return(status);
}
对不起,你是对的。我问题方向找错了,应该是nxd_udp_socket_send正确返回,却没有释放包。
nxd_udp_socket_send返回NX_SUCCESS,但是nx_packet_pool_available却没有增加
nxd_udp_socket_send发送成功的包,应该哪里被销毁?
@chengshuihang NX_SUCCESS means the packet has been sent to network driver, then driver should release the packet after transmission, refer to https://learn.microsoft.com/en-us/azure/rtos/netx-duo/chapter4#nxd_udp_socket_send
ok,你关闭它吧,等我找到原因,我再开
当我使用nxd_dns_host_by_name_get获取ip时,发生失败事件后,nx内存池nx_packet_pool_available数量减少,不会恢复