(#20447) Wait for server to shutdown before exiting daemon

This PR is the master branch version of GH-1627.

Previously, if the filetimeout was set to 0 and the puppet master was run,
the master would exit immediately. This was caused by the scheduler having
nothing to do and the new logic for it causes it to stop running at that
point (because once there is nothing to do, there is also no chance that
something will cause it to having something to do). There was a slightly
wrong assumption that was being made for that logic: the scheduler is in
control of all activity in the daemonized process. This is not the case.

The daemon has 3 parts to it:
 * configuration reparse
 * agent runs
 * server control

The server does not take part in the scheduler inside the daemon. It is
assumed to be a separate thread/process, which the daemon will kick off
when it starts, and stop when the daemon is told to stop. When the
"start" method of the daemon exits, the daemon itself exits and the server
will be required to shut down.

There are 2 ways that could be used to solve this problem: have the
scheduler sit in a busy loop (or sleep forever) when it has nothing to do,
or wait for the server to finish before the daemon considers itself done.
This commit uses the latter option.

The new code will wait for the server to finish before the Daemon#start
method returns. This makes the dependency explicit rather than hidden in
an infinite loop in the scheduler.

In addition to the above described fix (from GH-1627) this also has multiple
refactors to how the Daemon and Network::Server interact.