Hi Markus,
Seems that current version is more correct.
Notification callback is called while connection is still in
cleanup (not fully closed). Supposed that application will do
cleanup related to this specific connection, and, after
application-side cleanup, MHD preform cleanup on its side.
Number of connection must decremented only after connection is
cleaned and removed from list of connections.
MHD cleanup should be preformed only after cleanup on application
side.
For single threaded MHD, you can use interpret "1" for number of
connection as "closing last connection". For multi-threaded MHD
any assumptions about number current connections are not
thread-safe.
I'll check whether documentation should be clarified.
--
Wishes,
Evgeny
01.12.2017 21:29, Markus Doppelbauer
пишет:
Hello,
I have a problem with this commit:
void NotifyConnectionCallback( ... )
{
const union MHD_DaemonInfo *daemoninfo =
MHD_get_daemon_info( daemon, MHD_DAEMON_INFO_CURRENT_CONNECTIONS
);
if( toe == MHD_CONNECTION_NOTIFY_CLOSED
&& daemoninfo->num_connections == 0 )
{
... do something if all connections are closed ...
}
}
"daemoninfo->num_connections" never becomes zero - because
it is decremented after the "MHD_CONNECTION_NOTIFY_CLOSED"
event.
Thanks a lot
Markus
Am Montag, den 27.11.2017, 23:57 +0300 schrieb Evgeny Grin:
Dear all,
I'm glad to announce the release of GNU libmicrohttpd 0.9.57.
GNU libmicrohttpd is a small C library that is supposed to make it easy
to run an HTTP server as part of another application. GNU libmicrohttpd
is fully HTTP 1.1 compliant and supports IPv6. Finally, GNU
libmicrohttpd is fast, portable and has a simple API and (without TLS
support and other optional features) a small binary size (~32k).
Most noticeable changes since version 0.9.55:
* Huge internal refactoring of handling connections with most
improvement for HTTPS connections.
* Added support for debug asserts (configure parameter
'--enable-asserts').
* Added ability to bind to free available port with automatic detection
of resulting port number (useful for automated testing of
applications).
* Dropped support for Symbian (was broken a long time ago).
* Portability fixes for GNU Hurd.
* Dropped dependency on libgcrypt with new GnuTLS versions.
* Added feature check for MHD ability to suppress SIGPIPE signals on
MHD connections.
* Added internal check for using correct by application when providing
response. WARNING: badly designed apps may stop working.
* Fixed sending and receiving large data over HTTPS in epoll mode.
* Fixed most compiler warnings for '-Wall -Wextra'.
* Used chunks for sendfile() transfers, improved distribution of
CPU resources per connection.
* Ability to build demos without libmagic.
* Added support for sendfile() on FreeBSD, Solaris/OpenIndiana and
Darwin with additional optimizations on FreeBSD 11.
* Fixed and improved GnuTLS detection in configure.
* Added MHD_free() for freeing MHD-allocated memory on application
side, useful for W32 with several CRT libs.
* Added special tricks in configure to support Solaris/OpenIndiana.
* Other portability fixes.
* Minor fixes.
* Various multi-thread improvements.
This is bugfix release.
Most noticeable changes since version 0.9.56:
* Fixed builds with compiler optimization for size.
* Corrected names in W32 DLL resources.
* Improved Cygwin support.
* Improved and clarified configure summary message.
* Added configure parameter to disable sendfile() usage.
* Removed need on all platforms to explicitly initialize libmicrohttpd.
You can download GNU libmicrohttpd from
* https://ftp.gnu.org/gnu/libmicrohttpd/ and all GNU FTP mirrors.
* Our git repository at https://gnunet.org/git/libmicrohttpd.git
Please report bugs to our bugtracker at https://gnunet.org/bugs/.
The documentation (including a reference manual and tutorial) can be
found at https://www.gnu.org/software/libmicrohttpd/.