shutdown_handler: really shutdown when we are last

If we are a master and we don't have peers, there is no use keeping the
sessions alive, when we'll restart we will have forgotten them all.
Better gracefully close them, so they can be quickly respawn on restart,
instead of having to wait for timeouts.
This commit is contained in:
Samuel Thibault 2024-01-21 00:36:39 +01:00
parent 2229ac6a8a
commit 9daccab8ba
3 changed files with 10 additions and 1 deletions

View file

@ -754,6 +754,14 @@ void cluster_check_master(void)
// should also update.
}
//
// Returns whether we have peers.
//
int cluster_have_peers(void)
{
return num_peers > 0;
}
//
// Check that our session table is validly matching what the