[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] MHD_USE_POLL trouble
From: |
klemens |
Subject: |
[libmicrohttpd] MHD_USE_POLL trouble |
Date: |
Sun, 15 Jan 2023 15:50:35 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi all,
thanks first for your quick reply but this didn't solve the
issue. Most of my code is derived from the "post_example.c",
though I only use the GET method to pick up some values from
connecting users. I create a session for each incoming new
request and record session start time. The answer is a simple
webpage dynamically created for the URL from a database. After
receiving the filled form/submitted page from the user, I send a
confirmation that details the received values. All this works
nicely and timely.
After a sucessful receipt I want to expire the session soon. In
case the session remains idle for 15 Min I want to expire it too.
Here is my code:
daemon = MHD_start_daemon ( MHD_USE_INTERNAL_POLLING_THREAD
| MHD_USE_POLL,
8888,
&on_client_connect,
myclient_ip,
&create_response, NULL,
MHD_OPTION_CONNECTION_TIMEOUT,
(unsigned int)
900,
MHD_OPTION_END
);
if (NULL == daemon)
return (emsg ("Can't create daemon"));
while (1)
{
expire_sessions ();
if (MHD_get_timeout (daemon, &mhd_timeout) == MHD_YES)
{
tv.tv_sec = mhd_timeout / 1000;
tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
tvp = &tv;
}
else
tvp = NULL;
MHD_run (daemon);
}
MHD_stop_daemon (daemon);
I thought I would block the mainloop for 900 sec, in case there is no
new request, but this seems to cause the idle-loop. Any hints how to
fix this problem and expire completed/idle sessions is highly appre-
ciated.
kginbg.