libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Expose the fdset events


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Expose the fdset events
Date: Sun, 25 Nov 2012 19:43:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2

On 11/25/2012 05:07 PM, Simon Newton wrote:
I use microhttpd with the Open Lighting Architecture. As I've posted
before we have a C++ wrapper around libmicrohttpd (HTTPServer), which
then integrates with OLA's event management system.

While this works, it's rather messy. The wrapper sets up a call to a
HTTPServer::UpdateSockets() method into the event loop, and
UpdateSockets() calls MHD_get_fdset to find out what FDs microhttpd is
interested in.

It then loops over all the FDSETs and tries to reconcile the event
manager's state with the desired state from microhttpd. This involves
adding and removing Socket objects from the event manager.

I'd prefer it if I could set a callback to be run each time a FD
should be added or removed from the event manager. Is that easy enough
to do?

"Easy enough" is hard to say, what I can say is that it would not be trivial.

However, that doesn't mean it will never happen --- something similar would be needed to make MHD work with epoll/kqueue-based event loops, which is in general a nice system call that in a perfect world MHD should be able to utilize.

Nevertheless, the change would be quite invasive and would require work that I won't be able to put in anytime soon. So I guess what I'm saying is that, while I'm not opposed, I don't see this happen anytime soon unless I magically get a patch ;-).

Also, have you considered "improving" your event manager by extending its interface to allow it to work also with fdsets directly? Depending on the system call that are you using internally in your event manager this might be trivial.


Happy hacking!

Christian




reply via email to

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