libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] MHD_suspend_connection API


From: Jared Cantwell
Subject: Re: [libmicrohttpd] MHD_suspend_connection API
Date: Tue, 4 Feb 2014 20:08:14 -0700

Hey Luke,

We are using this functionality and it is working for us.  Here are some notes that I hope can help you, we haven't had a chance to dig through your code specifically.

1. After we receive some data in the access handler callback (*upload_data_size > 0) we decide whether we've buffered enough internally, and if so, we call MHD_suspend_connection()

We do not call this on the final callback with *upload_data_size == 0 since we will not get another callback from mHTTPD

2. In the background (on another thread), we process the data we have buffered. If the buffer shrinks enough, we call MHD_resume_connection()

3. We will get called back in the access handler after we resume, and we have also seen occasional callbacks while suspended, which we ignore; we keep track of our suspended state.

4. We are running the server with these options: 

   MHD_USE_SUSPEND_RESUME (which in turn implies MHD_USE_PIPE_FOR_SHUTDOWN)
   MHD_USE_SELECT_INTERNALLY

and we have passed in a value for MHD_OPTION_THREAD_POOL_SIZE to use a thread pool

Hope this helps,
~Jared



On Tue, Feb 4, 2014 at 7:48 PM, Luke-Jr <address@hidden> wrote:
On Tuesday, January 21, 2014 4:00:43 AM Luke-Jr wrote:
> On Tuesday, December 03, 2013 8:45:55 PM Christian Grothoff wrote:
> > libmicrohttpd 0.9.32 adds the 'MHD_suspend_connection' API for suspending
> > connections so that they can be resumed later when the server has more
> > data.  This was previously not possible when using a thread pool or
> > internal select.  Note that in thread-per-connection mode the application
> > must still not use this call and should instead simply block.
>
> How is this supposed to work? It seems that if I resume the connection,
> nothing is ever called again. Calling my handler manually after resuming
> also yields no results. I can't seem to locate any examples or other
> software using this interface either.
>
> In case my attempted code is helpful: http://codepad.org/RQNIZ2rx

So... does the lack of response mean nobody has tested or used this, and it's
just entirely broken? :(

Luke



reply via email to

[Prev in Thread] Current Thread [Next in Thread]