On Thursday, September 08, 2011 08:41:46 PM Regis Louge wrote:
> Here is my callback function :
>
> static ssize_t
> push_callback (void *cls, uint64_t pos, char *buf, size_t max)
> {
> PushElement *push = cls;
> if(push->pushReceived == 1){
> ...
> Store push data in buf
> ...
> return strlen(buf);
> }
> else return 0;
> }
>
> In my answer_to_connection for the URL /push I have :
>
> response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN,
> 32 * 1024,
> &push_callback,
> push,
>
> &push_free_callback);
> if(response == NULL)
> {
> return MHD_NO;
> }
> MHD_add_response_header (response, "Content-Type", "text/html;
> charset=utf-8");
> ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
> MHD_destroy_response (response);
> return ret;
>
> For a test case, when my client accesses to /push using curl -N -GET
> ".../push" he receives all the push notifications like it is suppose to,
> when I cancel it (^C), nothing happens on my server, request_completed is
> not called and neither is push_free_callback (which is the cleanup
> function)
>
> On Thu, Sep 8, 2011 at 8:19 PM, Christian Grothoff
>
> <
address@hidden>wrote:
> > Hi!
> >
> > Can you provide some kind of testcase that shows that MHD doesn't
> > properly call the cleanup function?
> >
> > Happy hacking!
> >
> > Christian
> >
> > On Thursday, September 08, 2011 12:56:13 PM Regis Louge wrote:
> > > Hi,
> > >
> > > I am currently trying to implement push notifications using
> > > libmicrohttpd and MHD_create_response_from_callback returning 0 until
> > > an event triggers the push. This seems to work pretty fine except for
> > > when the client interrupts the communication, then the cleanup method
> > > is not called and thus creates a lot of problems and impossibility to
> > > "subscribe" again to the push stream.
> > >
> > > --
> > > Regis