Hmm, that should help. I have several send_reply_chunk() though. Are you 
suggesting they should form nested callback chains?

-Haiping


On 9/4/09 3:19 PM, "q6Yr7e0o nIJDVMjC" <u9oqc...@googlemail.com> wrote:

Shouldn't you call evhttp_send_reply_end in the callback of
evhttp_send_reply_chunk which is only called if the sending succeeded?




On 9/4/09, Haiping Zhao <hz...@facebook.com> wrote:
> Hi, there,
>
> I'm reading evhttp's source code, and I'm not sure if I've found a bug, or I
> just mis-read it. But it seems to me, when I do chunked encoding on
> response, I'd call three functions sequentially somehow,
>
> evhttp_send_reply_start(req, ...);
> evhttp_send_reply_chunk(req, ...);
> evhttp_send_reply_end(req, ...);
>
> Here's the problem, if any of the 1st two fails to send some packets, i.e.,
> evbuffer_write() returned -1 or 0, it will call evhttp_connection_fail(),
> which will free the request eventually if connection needs to be closed by
> evhttp_connection_free().
>
> Now, how does my subsequent call know "req" is freed? Wouldn't that cause
> crashes, if I simply call those 3 functions in a row? Or did I miss some
> correct way of calling them?
>
> Thanks.
>
> -Haiping
>
> _______________________________________________
> Libevent-users mailing list
> Libevent-users@monkey.org
> http://monkeymail.org/mailman/listinfo/libevent-users
>

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to