lwip_close on master esp-idf
Posted: Sat Mar 11, 2017 7:22 am
Hi -
With esp-idf 4745895e229d8e1ca4e6f4b601397c0ba0b3d2db, close(socket_fd) ends up in lwip_close() okay. That does netconn_delete() OK. Currently, freeing the socket is skipped though.
#if !ESP_THREAD_SAFE
free_socket(sock, is_tcp);
#endif
I assume it's supposed to be done lazily later.
But any closed fd's are not made available for reuse, the next fd to open monotonically increases until we run out of space to map them.
Is this because the lazy fd freeing thread cannot run, or something else?
On a normal posix system the fd is freed and then the lowest free fd is used for each new open / socket, but that does not happen here.
With esp-idf 4745895e229d8e1ca4e6f4b601397c0ba0b3d2db, close(socket_fd) ends up in lwip_close() okay. That does netconn_delete() OK. Currently, freeing the socket is skipped though.
#if !ESP_THREAD_SAFE
free_socket(sock, is_tcp);
#endif
I assume it's supposed to be done lazily later.
But any closed fd's are not made available for reuse, the next fd to open monotonically increases until we run out of space to map them.
Is this because the lazy fd freeing thread cannot run, or something else?
On a normal posix system the fd is freed and then the lowest free fd is used for each new open / socket, but that does not happen here.