[Top][All Lists]

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

[libmicrohttpd] minor issue with epoll+external select+no_timeout

From: Marcos Pindado Sebastian
Subject: [libmicrohttpd] minor issue with epoll+external select+no_timeout
Date: Wed, 18 Jun 2014 09:40:24 +0000


I want to share this little issue I had while implementing an external select 
Case: daemon configured with MHD_USE_EPOLL_LINUX_ONLY plus EXTERNAL_SELECT.

The typical example for the external select is:

MHD_start_daemon (epoll)
while (1)
   MHD_get_fdset (...)
   select(fds, timeout)

Well, the example worked as far as I noticed that timeout had value 0 (not 
null), meaning not waiting at all. When I changed it to NULL then the example 
stopped working, because the program got blocked in the select statement not 
being notified of incoming connections.
The problem is, MHD_start_daemon, creates the epollFD before the listen-socket 
is set up. So, get_fdset returns a well epoll-fd without any listen socket 
attached just after start_daemon returns.

The solution for this is very simple, call MHD_run one time after the daemon is 
started and before the select-loop:

MHD_start_daemon (epoll)
MHD_run // => The listen socket is attached to the epollFD 
while (1)

Thanks for your work!
Verificada la ausencia de virus por G Data MailSecurity

VersiĆ³n: AVA 24.2721 del 18.06.2014 
Noticias de virus:

reply via email to

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