|
From: | address@hidden |
Subject: | Re: [lwip-users] Dealloc in fs_close_custom()? |
Date: | Mon, 26 Feb 2018 19:45:06 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 26.02.2018 16:51, Giuseppe Modugno wrote:
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.
That's not fully correct. The default behaviour is that data is copied for dynamic files (where buf != NULL). This should cover SSI files as well as custom files, but it could be that it doesn't cover your setup of custom files.
You either can adjust the macro HTTP_IS_DATA_VOLATILE() in that case, or come up with a patch that would keep the file open until everything is ACKed.
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |