❦ 12 août 2012 11:02 CEST, Vincent Bernat <ber...@luffy.cx> : > I am trying to use HTTP chunked answers to implement a publish/subscribe > mechanism on top of evhttp. A client will subscribe to a topic by > requesting some URL, I invoke evhttp_send_reply_start(), put the request > into some list and once a message is available for a topic, I take my > list and for each member, I will send the new messages with > evhttp_send_reply_chunk(). > > My question is: how do I handle the case where the client disconnects? I > have found a similar problem in this post: > http://archives.seul.org/libevent/users/Jan-2010/msg00054.html > > The linked gist does not crash anymore but, in my case, I need to remove > the "dead" clients from my linked list (or I will soon run into some > memory issue).
Reading a bit the source code, I have discovered that I can check if `evhttp_request_get_connection(h->req)` is `NULL` or not. If it is, I need to remove the request from my list of requests. -- Watch out for off-by-one errors. - The Elements of Programming Style (Kernighan & Plauger) *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.