On Tue, May 4, 2010 at 4:58 PM, Vasiljevic Zoran <z...@archiware.com> wrote:
> Hi!
>
> Quite often I see:
>
>    Ns_ConnWriteData(conn, NULL, 0, 0);
>
> This is OK but not very readable. Can we add something like
>
>    Ns_ConnFlushData(conn, flags)
>
> convenience wrapper that would supply the NULL buffer and
> zero bytes to the Ns_ConnWriteData() ?
>
> This would add zero functionality but would make the
> programmers intention more clear.


Hmm... well it's not *too* often that you see it. Some of the places
where it's currently done is probably a mistake, and sometimes it's
because the api doesn't quite let you do what you need.

For example, return.c:ReturnRange() flushes the headers by calling
Ns_ConnWriteData with a null buffer before calling
Ns_ConnSendFileVec() because the latter is low level enough, for
flexibility, that it completely ignores headers, for alternate
protocols etc. But the vector sending code can actually handle memory
buffers as well as files, so ideally you'd want to dump the headers to
a string buffer then pass them on to SendVec. Or something...

What is being buffered that you're trying to flush?

------------------------------------------------------------------------------
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to