>> 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 > "MHD_DAEMON_INFO_WAS_QUIESCED" or, in my case > "MHD_DAEMON_INFO_WAS_STOPPED". > > My current implementation is the following. > When a websocket upgrade is called by the client, the websocket callback > is executed: > https://github.com/babelouest/ulfius/blob/2.0/src/ulfius.c#L432 > Then the program loops on listening to the socket > https://github.com/babelouest/ulfius/blob/2.0/src/u_websocket.c#L115 > > 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. > https://github.com/babelouest/ulfius/blob/2.0/example_programs/websocket_example/websocket_example.c Could you provide a minimal example? -- Wishes, Evgeny
