search for: exitlast_close

Displaying 2 results from an estimated 2 matches for "exitlast_close".

2020 Mar 04
0
[PATCH nbdkit 3/4] New filter: exitlast filter to exit on last client connection.
...ro we exit. */ +static _Atomic unsigned connections; + +static void * +exitlast_open (nbdkit_next_open *next, nbdkit_backend *nxdata, + int readonly) +{ + if (next (nxdata, readonly) == -1) + return NULL; + + connections++; + + return NBDKIT_HANDLE_NOT_NEEDED; +} + +static void +exitlast_close (void *handle) +{ + if (--connections == 0) { + nbdkit_debug ("exitlast: exiting on last client connection"); + nbdkit_shutdown (); + } +} + +static struct nbdkit_filter filter = { + .name = "exitlast", + .longname = "nbdkit exitlast filter&q...
2020 Mar 04
7
[PATCH nbdkit 0/4] server: Add nbdkit_shutdown() call and two new filters.
This adds a new nbdkit_shutdown() API whereby plugins and filters can request that the server shuts down (asynchronously) during the serving phase. Two new filters are added, one of which depends on this feature and the other not needing it but being somewhat related. Rich.