Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Evgeny Grin
Hi Nicolas, On 04.05.2017 3:18, Nicolas Mora wrote: > I'm currently working on an implementation of a websocket manager with > MHD and it's getting pretty good so far. > > The problem I have is when the daemon is shut down and there are open > connections. The documentation on MHD_quiesce_daemon s

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Nicolas Mora
Hi, Thanks Evgeny and Silvio for your help Le 2017-05-04 à 03:02, Evgeny Grin a écrit : MHD_quiesce_daemon() prevent MHD from accepting new connections but allow to continue processing with current connections. The returned socket is listening socket. Actually, I'm not using MHD_quiesce_daemo

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Evgeny Grin
>> MHD_stop_daemon() will close all connections including "upgraded" >> connections. So you can't use "upgraded" connections after >> MHD_stop_daemon(). >> > The problem I have is that MHD_stop_daemon() doesn't close all the > connections. Instead, it looks like it waits for the active connections

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Nicolas Mora
Do you use HTTP or HTTPS? Eventually, since it's a framework for both http and https, I will use both protocols. You must not call MHD_stop_daemon() while you still have some not closed "upgraded" connections. May be we should add more alarming message in case of such API violation. I unders

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread silvioprog
On Thu, May 4, 2017 at 8:47 AM, Nicolas Mora wrote: [...] > Silvio's suggestion might work too, some signal like a > "MHD_DAEMON_INFO_WAS_QUIESCED" or, in my case "MHD_DAEMON_INFO_WAS_STOPPED". I'm going to send a patch to Evgeny ... -- Silvio Clécio

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Evgeny Grin
On 04.05.2017 16:41, Nicolas Mora wrote: >> >> Do you use HTTP or HTTPS? > Eventually, since it's a framework for both http and https, I will use > both protocols. Behavior in undefined situation can differ in HTTP and HTTPS modes. MHD_stop_daemon() should close all upgraded connections in HTTPS mo

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread silvioprog
Done. So dudes, what do you think about this attached patch? On Thu, May 4, 2017 at 10:45 AM, silvioprog wrote: > On Thu, May 4, 2017 at 8:47 AM, Nicolas Mora > wrote: > [...] > >> Silvio's suggestion might work too, some signal like a >> "MHD_DAEMON_INFO_WAS_QUIESCED" or, in my case "MHD_DAEMO

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Christian Grothoff
You forgot to update doc/libmicrohttpd.texi, otherwise looks OK even though I'm not convinced SHUTDOWN/QUESTCED are useful: an application can trivially track those itself, so these two are definitively just API bloat. On 05/04/2017 03:59 PM, silvioprog wrote: > Done. So dudes, what do you think a

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Evgeny Grin
Same for "pending data". Moreover MHD_DAEMON_INFO_PENDING_DATA is confusing and not correct. Zero in data_already_pending doesn't mean that no data is pending. Zero only means that "no data for immediately process". May be socket is not ready for sending more data, but more data is pending. And ma

[libmicrohttpd] [PATCH] Check response existence on upgrade

2017-05-04 Thread José Bollo
When a connection upgrade is requested and when the request sent an error reply, the response is most of the time already sent when the test on connection->response->upgrade_handler is made, leading to dereferencing NULL. Two possibilities exist: NULL == connection->response || NULL == connecti

Re: [libmicrohttpd] [PATCH] Check response existence on upgrade

2017-05-04 Thread Evgeny Grin
Thanks! Applied. -- Best Wishes, Evgeny Grin On 04.05.2017 22:58, José Bollo wrote: > When a connection upgrade is requested and when the > request sent an error reply, the response is most of > the time already sent when the test on > connection->response->upgrade_handler is made, leading > to