nghttpx: Save PID file after it is ready to accept connections
This commit is contained in:
parent
c39a669671
commit
9f770fec36
12
src/shrpx.cc
12
src/shrpx.cc
|
@ -946,10 +946,6 @@ int event_loop() {
|
|||
redirect_stderr_to_errorlog();
|
||||
}
|
||||
|
||||
if (!get_config()->pid_file.empty()) {
|
||||
save_pid();
|
||||
}
|
||||
|
||||
SignalServer ssv;
|
||||
|
||||
rv = pipe(ssv.ipc_fd.data());
|
||||
|
@ -996,6 +992,14 @@ int event_loop() {
|
|||
worker_process_childev.data = nullptr;
|
||||
ev_child_start(loop, &worker_process_childev);
|
||||
|
||||
// Write PID file when we are ready to accept connection from peer.
|
||||
// This makes easier to write restart script for nghttpx. Because
|
||||
// when we know that PID file is recreated, it means we can send
|
||||
// QUIT signal to the old process to make it shutdown gracefully.
|
||||
if (!get_config()->pid_file.empty()) {
|
||||
save_pid();
|
||||
}
|
||||
|
||||
ev_run(loop, 0);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue