On 12/06/2012 02:58 AM, Sebastiano
Merlino wrote:
Hi Christian,
thanks for your reply. I implemented a "multi-thread external
select" using your suggestion of providing the same external non
blocking socket to multiple daemons.
My question now is, once the content_reader_callbacks returns
0 (because it has not still the data), the file descriptor seems
to be removed from the library's fd_sets. Have I to store the
file descriptor somewhere and re-insert it inside the write
fd_set manually or there is another way?
MHD will put it back for you -- once your content reader callback
returns non-zero! You are waiting on some OTHER kind of event
(presumably, after all, you wanted to produce the data
asynchronously!), which you put into the select. Once that OTHER
event produces data, you call MHD_run again and it will again call
your callback (without the FD being in 'select'); once your callback
returns non-zero, MHD will put the socket back into the FD set.
Happy hacking!
Christian
Thanks,
Sebastiano
|