I read the examples in lwip-contrib, mainly genfiles_example.c. The
dynamic memory allocated for the file content is freed in
fs_close_custom(). However I couldn't explain why.
Indeed, mostly if the content is small, it is completely sent in
http_recv()/http_send()/http_eof()/http_close_conn()/http_close_or_abort_conn()/http_state_free()/fs_close()/fs_close_custom().
tcp_write() is called in http_write() without TCP_WRITE_FLAG_COPY, at
least it seems so to me. If I understood well, this means the content
isn't copied in another buffer, so it *will* be sent from the original
*dynamic* buffer. When fs_close_custom() is called, the content is
pushed in the output queue, but it isn't actually sent over the wire.
So is it correct to free the dynamic buffer in fs_close_custom()?
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users