NetworkBlockDevice / nbd

Network Block Device
GNU General Public License v2.0
450 stars 116 forks source link

nbd-server: Add option to not daemonize main process #139

Closed jan-krieg closed 1 year ago

jan-krieg commented 1 year ago

This pull requests addresses #132 by adding the new option -n/--nodaemon to nbd-server. When set, it keeps the main process in the foreground, while still allowing to fork the serving process for a client. Functionally, it should be equivalent to providing NODAEMON to the preprocessor.

The commit also fixes a minor inaccuracy in the usage() function, which wrongly stated that the long option of -M is --max-connections (with trailing 's'). While conceptually unrelated, I've still included it as it's a trivial fix; let me know in case I should take it out.

I should note that I'm completely new to the nbd codebase, thus hoping I didn't miss anything relevant. Did some manual testing though (using live ebuild on Gentoo + patch to build it and then playing around with a few client connections) and it seems to work fine.