Page Speed Optimization Libraries
1.13.35.1
|
#include "controller_manager.h"
Static Public Member Functions | |
static void | ForkControllerProcess (std::unique_ptr< ControllerProcess > &&process, SystemRewriteDriverFactory *factory, ThreadSystem *thread_system, MessageHandler *handler) |
static void | DetachFromControllerProcess () |
Handles forking off a controller process, restarting it if it dies, and shutting down the process if the host reloads config or shuts down.
We fork a babysitter process, which forks a controller process. If the controller process dies without calling exit(0) the babysitter will fork off another controller.
The controller runs a thread that watches for the root process to die, or to ask it to quit. We use pipes for communication between the master process and the controller. If the master process goes away, the controller reading will get EOF. If the master process wants the controller to shut down so it can be replaced, it writes a byte.
(All methods in the ControllerManager are static. When you call ForkControllerProcess() it keeps running until process exit.)
|
static |
Relinquishes the reference from us to the controller process. This may be needed if our current process is going to go on and do something unrelated.
|
static |
Called on system startup, before forking off any workers. Starts up a babysitter process that starts a controller process and restarts the controller if it dies. Also called (again) on configuration reloading.