libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] feature request: give a possibility to re-assign cal


From: Evgeny Grin
Subject: Re: [libmicrohttpd] feature request: give a possibility to re-assign callbacks
Date: Mon, 27 Mar 2017 23:19:52 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 27.03.2017 17:29, Vitaliy T wrote:
> 1. Subj.
Which callbacks would you like to reassign?

> 2. Why is this should be useful?
> 
> 2.1. When you're actively using suspend/resume functionality and later
> trying to shutdown the MHD daemon, then last one, by default, uses
> default callbacks (which were given at the startup) for _resumed_
> connections (as docs says).
> 
> By good intentions, such callbacks must be transformed into stubs,
> that is, { return MHD_NO; } to complete the task properly. Currently,
> it is possible to wait, I may say, weeks if there are thousands of
> active requests.

What prevents to return "MHD_NO" early from the same callback when required?

> 2.2. It gives a possibility to write, I have no good words for this
> except next, the polymorph-like servers. For instance, it may be funny
> (and may be be a serious work) to load an external shared library and
> then re-assign callbacks to the functions which the library contains.
> 
> Either, are there any alternatives about how to do tasks above I don't know?
Simple (pseudo code):

int callback(void *user_data)
{
  struct my_data * const info = (struct my_data *) user_data;
  switch(info->callback_type)
  {
    case use_callback_a: return call_callback_a(user_data);
    case use_callback_b: return call_callback_b(user_data);
    default:
      return info->current_callback(user_data);
  }
}

Will this work for you?


-- 
Wishes,
Evgeny



reply via email to

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