On Thu, Jul 31, 2008 at 7:17 PM, Alex Evans <[EMAIL PROTECTED]> wrote: > passed into a generic handler callback. instead it just saves the > evhttp_request pointer in my own list structure, and doesn't immediately call > evhttp_send_reply or equivalent. instead it falls back to the main dispatch > loop and lets other events happen. > some time later another event allows me to fill in a reply to the old > request, and so I call evhttp_send_reply on the stored request pointer. > my issue is, that looking at the http.c code there are a few ways that the > http_request I am storing a pointer to, could be freed. for example, if the > incoming > connection to a server goes away, it deletes all the outstanding requests. > however my code won't get any notification that the connection or requests > have > gone away, so I will merrily (later on) make use of the request pointer after > it's been freed. > what should I do? not use this pattern? use some callback mechanism I've > missed? worry less? or patch evhttp_request_free() to call an optional > callback?
That's a bug in the evhttp layer then; when you receive a callback and store the evhttp request object for later use, it should not be freed until you call evhttp_send_reply(). I am in Germany right now and won't have time to do any computer work. I'll look at it when I am back in the States at the end of August. If somebody would like to try their hand at a bug fix, that would be great. Niels. _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users