View Issue Details

IDProjectCategoryView StatusLast Update
0005653libmicrohttpdlibmicrohttpd APIpublic2019-05-27 14:53
ReportersilvioprogAssigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionwon't fix 
Product Version 
Target VersionFixed in Version 
Summary0005653: [FEATURE REQUEST] Event listener to reuse the builtin MHD's thread / loop
DescriptionHello.

It would be nice if MHD could allow something like this:

  d = MHD_start_daemon (MHD_USE_AUTO_INTERNAL_THREAD, 8080, NULL, NULL, &ahc_cb, NULL,
                                              MHD_OPTION_EVENT_LISTENER, &my_event, my_closure,
                                              MHD_OPTION_END);


this way, the "my_event()" would be triggered within internal MHD thread by its loop.

It would be useful:

- to expire sessions without using loop/mutex in the application thread
- to notify external classes that the server is live
- to reuse the internal library loop instead of the thread of VCL applications when their loop (idle) isn't available
TagsNo tags attached.

Activities

silvioprog

2019-03-18 08:37

developer   ~0014216

Possible better name for the option:

  MHD_OPTION_IDLE

Karlson2k

2019-05-25 10:58

developer   ~0014441

Still not clear the purpose of such external event listener.
MHD do not trigger internal processing if no data is coming and no data is scheduled to be sent.
Only exception is timeout expiration of connection, but you already can monitor it by 'MHD_OPTION_NOTIFY_CONNECTION'.

silvioprog

2019-05-26 07:37

developer   ~0014444

Last edited: 2019-05-26 07:38

View 2 revisions

> Still not clear the purpose of such external event listener.

It would be some callback triggered all the time by the built-in MHD loop, however, after the explanation below ...

> MHD do not trigger internal processing if no data is coming and no data is scheduled to be sent.

... this feature sounds not possible. The "on idle" event is present in some application designs, something like this:

do {
    /* ... process the application stuff ... */
    if (idle_callback)
        idle_callback();
} while (!app.terminated);


but, if I properly understood, in MHD we have something like this:

do {
    wait_for_client_stuff(); // if any connection/data never arrives, it still hold here, so the callback below isn't triggered
    if (idle_callback)
        idle_callback();
} while (!daemon.stopped);


so this feature couldn't be possible, and I'm inclined to set this issue as "won't fix".

Thanks for explaining!

Issue History

Date Modified Username Field Change
2019-03-16 18:51 silvioprog New Issue
2019-03-16 18:54 silvioprog Summary [FEATURE REQUEST] Event listener to reuse the MHD's thread / loop => [FEATURE REQUEST] Event listener to reuse the builtin MHD's thread / loop
2019-03-18 08:37 silvioprog Note Added: 0014216
2019-05-25 10:58 Karlson2k Note Added: 0014441
2019-05-26 07:37 silvioprog Note Added: 0014444
2019-05-26 07:38 silvioprog Note Edited: 0014444 View Revisions
2019-05-27 14:53 Karlson2k Status new => resolved
2019-05-27 14:53 Karlson2k Resolution open => won't fix