libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error


From: Evgeny Grin
Subject: Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error
Date: Wed, 15 Mar 2017 12:37:38 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 15.03.2017 12:10, Vitaliy T wrote:
> On 14 March 2017 at 23:21, Evgeny Grin <address@hidden> wrote:
>> MHD_get_fdset() may return MHD_NO if epoll FD is too high to fit fd_set
>> or if MHD_get_fdset() erroneously called for daemon with
>> MHD_USE_THREAD_PER_CONNECTION option.
> 
> Sorry, you are wrong.
> 
> src/microhttpd/daemon.c
> 
>       660 int
>       661 MHD_get_fdset (struct MHD_Daemon *daemon,
> ...
>       666 {
>       667   return MHD_get_fdset2 (daemon,
> ...
>       673 }
> 
>       913 int
>       914 MHD_get_fdset2 (struct MHD_Daemon *daemon,
> ...
>       920 {
>       921   struct MHD_Connection *pos;
>       922   struct MHD_Connection *posn;
>       923   int result = MHD_YES;
>       924   MHD_socket ls;
>       925
>       926   if ( (NULL == daemon) ||
>       927        (NULL == read_fd_set) ||
>       928        (NULL == write_fd_set) ||
>       929        (daemon->shutdown) ||
>       930        (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ||
>       931        (0 != (daemon->options & MHD_USE_POLL)))
>       932     return MHD_NO;
> ...
> 
> src/iinclude/microhttpd.h
>       882 enum MHD_FLAG
>       883 {
> ...
>      1038   MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY = MHD_USE_EPOLL |
> MHD_USE_INTERNAL_POLLING_THREAD,
> 
> 
> As you can see there is check against MHD_USE_POLL and if the flag is
> set then MHD_get_fdset() is always return MND_NO.

Can't see why you decide that I'm wrong.
If you start daemon with MHD_USE_THREAD_PER_CONNECTION or epoll FD is
too high then MHD_get_fdset()/MHD_get_fdset2() will return MHD_NO.
That's correct.

I didn't state that's the only conditions when
MHD_get_fdset()/MHD_get_fdset2() will return MHD_NO. There are number of
other conditions, which results in MHD_NO.

Probably we should update function description to explicitly specify
that it could be used only for daemon based on select() (obvious) and
based on epoll() (not obvious).

-- 
Best Wishes,
Evgeny Grin



reply via email to

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