Hi, so i checked my heap stats, and it seams to have a memory leak in the 
stated code below.
So one execution of netconn_connect sends out a SYN and about 6 retransmissions 
until it returns ERR_xxx.
Then I'm deleting it with netconn_delete and create a new one and start over 
with connect.
By checking my heap stats it seems to consume roughly 120bytes every cycle 
which are not getting returned.

Is there something wrong with this logic or actually a bug?

Cheers


Von: Sachs, Nico
Gesendet: Mittwoch, 18. August 2021 17:33
An: lwip-users@nongnu.org
Betreff: Netconn Client

Hi there.

I have a netconn client which tries to connect forever.
My application works fine for some hours, and then some weird things starts to 
appear, memp malloc fails for example and then another (connected) Netconn 
server stops to work.
The Netconn client can not connect because its not there, that's fine. It sends 
out every 2 second a syn forever..
Now if I disable this try to connect thread, it runs forever without problems. 
Could some please have a look at this piece of code if there is something wrong 
what I'm doing?

                                               conn = 
netconn_new_with_callback(NETCONN_TCP, com_netconn_cb);
                                               netconn_bind(conn, IP_ADDR_ANY, 
0);
                                               netconn_set_nonblocking(conn, 0);

                                               while (netconn_connect(conn, 
&remoteip, TCPPORT) != ERR_OK)
                                               {
                                                           if ( should_i_stop() 
)
                                                           {
                                                                       comstate 
= COMSTATE_DISCONNECTED;
                                                                       
netconn_delete(conn);
                                                                       break;
                                                           }
                                                           netconn_delete(conn);
                                                           conn = 
netconn_new_with_callback(NETCONN_TCP, com_netconn_cb);
                                                           netconn_bind(conn, 
IP_ADDR_ANY, 0);
                                                           
netconn_set_nonblocking(conn, 0);
                                               }

Thanks in advance
Nico
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to