[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] The purpose of dontfork in handle_connection()?



On Mon, Mar 11, 2013 at 09:35:33PM +0200, Tuomas Räsänen wrote:
> Hi
> 
> What is the purpose of testing the 'dontfork' -flag inside
> handle_connection()?
> 
> Its usage in main() is obvious: to check whether the server should
> daemonize or not, but why it's also used in handle_connection() to
> check whether to fork a handler or not. Seems a bit weird to me.
> 
> To not daemonize the parent process can be helpful when
> debugging/testing etc., but to not fork a connection handler makes the
> server effectively a one shot wonder and useless even in debugging
> sessions, right?

The debugging output currently doesn't distinguish between client
sessions (it probably should), which means that if we fork with
debugging output, it's pretty difficult to make sense of the output.

It's probably a good idea to change that, yes.

> ( If someone wonders why I stumbled across this one: I'll try to move
> the whole negotiation procedure to the child process, and cleanup the
> server code alongside. )

I've long longed for a set of fresh eyes over the code, much like you're
doing now. Cleaning up your own code is something that's surprisingly
difficult if you have to do it all by yourself. In that light, your
efforts are much appreciated. Thanks!

-- 
Copyshops should do vouchers. So that next time some bureaucracy requires you
to mail a form in triplicate, you can mail it just once, add a voucher, and
save on postage.



Reply to: