[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Suspending/resuming not working with external select
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] Suspending/resuming not working with external select |
Date: |
Sun, 4 Sep 2016 17:53:22 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 |
Dear Johannes,
You need to run "MHD_run()" between resuming and asking for the FD set.
It was not very well documented, so I've fixed the documentation in SVN
37877.
You also didn't FD_ZERO your fdsets, but that's minor. I've attached
your code with my changes, so that it works.
Happy hacking!
Christian
On 09/04/2016 03:49 PM, Johannes Spangenberg wrote:
> Hello,
>
> I encountered some problems while using the libmicrohttpd. I was using
> MHD_suspend_connection() and MHD_resume_connection() in combination with
> an external event loop. The problem was that the connection was not
> resumed until another request was made. I checked the event loop but
> they was running and calling MHD_run_with_select() periodically.
> Afterwards, I wrote a small test program, attached to this mail, to
> check if it is a bug or misunderstanding of the library. I also tested
> it agains the last version (0.9.51).
>
> Connections are still not resumed in the small test program. But in
> difference to my original project, receiving another request does not
> resume the first connection. The second request is never accepted by
> libmicrohttpd. It seems that select() does not return to acceppt the
> second connection after calling MHD_suspend_connection() on the first
> one. If I'm not calling MHD_suspend_connection() and
> MHD_resume_connection(), everythink works. Futuremore, if I am using
> MHD_USE_SELECT_INTERNALLY and replace the external loop with a busy
> loop, everything works as well. I thinks it looks like there is a bug in
> MHD_suspend_connection() and MHD_resume_connection() when used with
> external select. Could someone take a look and check whether I'm doing
> something wrong or there is a bug in the library.
>
> I searchd for it but could not find a solution to fix it. A found
> another conversation in the mailing list: [MHD_suspend_connection
> API](http://lists.gnu.org/archive/html/libmicrohttpd/2014-02/msg00005.html).
> It is not clear but thing it may be possible that he stumbled over the
> same bug.
>
> My english is not the best but I hope you can understand everything.
> Johannes
>
main.cpp
Description: Text Data
signature.asc
Description: OpenPGP digital signature