[Top][All Lists]

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

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

From: Evgeny Grin
Subject: Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?
Date: Thu, 4 May 2017 16:23:04 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

>> 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
> to close by themselves and I have the following log message:
> Initiated daemon shutdown while "upgraded" connection was not closed.

Do you use HTTP or HTTPS?
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.

>> Could you explain a bit more situation that you need to solve?
>> Do you want to implement graceful MHD shutdown after closing all
>> upgraded connections?
> I guess what I'd rather have is for the upgraded connections to be
> closed by MHD when MHD_stop_daemon() is called, so the upgrade callback
> could interpret it easily.
> Silvio's suggestion might work too, some signal like a
> My current implementation is the following.
> When a websocket upgrade is called by the client, the websocket callback
> is executed:
> Then the program loops on listening to the socket
> But in my example program, when the user stops the program by pressing
> the <enter> key while connections are active, the program doesn't stop
> and waits for the open websockets to close.

Could you provide a minimal example?


reply via email to

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