View Issue Details

IDProjectCategoryView StatusLast Update
0005653libmicrohttpdexternal APIpublic2019-08-01 12:38
Reportersilvioprog Assigned ToDue Date
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionwon't fix 
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 07:37

reporter   ~0014216

Possible better name for the option:

  MHD_OPTION_IDLE

Karlson2k

2019-05-25 08:58

manager   ~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 05:37

reporter   ~0014444

Last edited: 2019-05-26 05:38

> 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 ModifiedUsernameFieldChange
2019-03-16 17:51silvioprogNew Issue
2019-03-16 17:54silvioprogSummary[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 07:37silvioprogNote Added: 0014216
2019-05-25 08:58Karlson2kNote Added: 0014441
2019-05-26 05:37silvioprogNote Added: 0014444
2019-05-26 05:38silvioprogNote Edited: 0014444
2019-05-27 12:53Karlson2kStatusnew => resolved
2019-05-27 12:53Karlson2kResolutionopen => won't fix
2019-08-01 12:38Christian GrothoffStatusresolved => closed
2024-01-21 12:24Christian GrothoffCategorylibmicrohttpd API => external API