[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Dealloc in fs_close_custom()?

From: Giuseppe Modugno
Subject: [lwip-users] Dealloc in fs_close_custom()?
Date: Mon, 26 Feb 2018 16:51:07 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

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()?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]