[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Dropping shutdown() on the listening socket from MHD
From: |
Lennart Poettering |
Subject: |
Re: [libmicrohttpd] Dropping shutdown() on the listening socket from MHD_stop_daemon()? |
Date: |
Thu, 1 Oct 2015 13:14:58 +0200 |
On Tue, 22.09.15 19:23, Christian Grothoff (address@hidden) wrote:
> Hi Lennart!
Heya!
>
> Nice to see you here. The reason why we call 'shutdown' on the listen
> FD was (IIRC) that this is one way to signal a thread that is
> select()ing on the FD (on Linux-only). This way, we don't have to use
> an extra pipe (or event-FD). So if MHD runs in thread-pool mode with 4
> threads and without a signaling pipe, this shutdown() on the listen
> socket is how we terminate the threads.
>
> Now, this does not work on some platforms (FreeBSD, no clue about
> W32/zOS/etc.), so we do also _allow_ the use of a pipe, and there is an
> option to "force" its use on Linux: MHD_USE_PIPE_FOR_SHUTDOWN.
>
> If that option is set, there is no real _need_ for MHD to call shutdown
> on the listen socket, and that would enable this use with systemd.
>
> We could also introduce a more explicit flag (i.e.
> MHD_NO_LISTEN_SHUTDOWN), but I think just modifying the code to check
> for MHD_USE_PIPE_FOR_SHUTDOWN and then documenting (and thereby
> guaranteeing) that this will disable shutdown() on the listen socket is
> the simplest option.
>
> I've implemented this in SVN 36369, diff attached.
Thanks for the quick turnaround!
I have now changed systemd to make use of the flag. As soon as the
distros get an updated version of libmicrohttpd and systemd, we should
be good then!
https://github.com/systemd/systemd/commit/ef08ced6b44d4f56477a6798e56ba5c5c9e0023f
Thanks!
Lennart
--
Lennart Poettering, Red Hat
- Re: [libmicrohttpd] Dropping shutdown() on the listening socket from MHD_stop_daemon()?,
Lennart Poettering <=