cancel
Showing results for 
Search instead for 
Did you mean: 

Potential race conditions in H7 Ethernet example(s)

bigfoot
Associate II

I am sorry if the question was already asked, but I cannot find something similar.

I have created LwIP_UDP_Echo_Server example for STM32H735G-DK, and after some efforts it works. So far so good.

Now I am porting the code to my actual project. I am stuck on the udp_echoserver_receive_callback that includes the following sequence

    udp_send(upcb, p_tx);
    udp_disconnect(upcb);
    pbuf_free(p_tx);

Is it safe to disconnect and release the buffer without any delay? LWIP documentation defines udp_send as non-waiting; therefore, immediate disconnection and buffer release looks like races with uncertain result.

Related question: is it possible to check if udp_send actually finished sending the data?

0 REPLIES 0