@@ -98,7 +98,7 @@ static void verification_cb(struct ev_loop* loop, ev_periodic* w, int revents);
9898static void valid_cb (struct ev_loop * loop , ev_periodic * w , int revents );
9999static void wal_streaming_cb (struct ev_loop * loop , ev_periodic * w , int revents );
100100static bool accept_fatal (int error );
101- static bool reload_configuration (void );
101+ static void reload_configuration (bool * restart );
102102static void service_reload_cb (struct ev_loop * loop , ev_signal * w , int revents );
103103static void reload_set_configuration (SSL * ssl , int client_fd , uint8_t compression , uint8_t encryption , struct json * payload );
104104static bool reload_services_only (void );
@@ -1373,7 +1373,7 @@ accept_mgt_cb(struct ev_loop* loop, struct ev_io* watcher, int revents)
13731373 clock_gettime (CLOCK_MONOTONIC_RAW , & start_t );
13741374#endif
13751375
1376- restart = reload_configuration ();
1376+ reload_configuration (& restart );
13771377
13781378 pgmoneta_management_create_response (payload , -1 , & response );
13791379
@@ -1430,6 +1430,8 @@ accept_mgt_cb(struct ev_loop* loop, struct ev_io* watcher, int revents)
14301430
14311431 pgmoneta_set_proc_title (1 , ai -> argv , "conf get" , NULL );
14321432 pgmoneta_conf_get (NULL , client_fd , compression , encryption , pyl );
1433+ pgmoneta_json_destroy (pyl );
1434+ exit (0 );
14331435 }
14341436 }
14351437 else if (id == MANAGEMENT_CONF_SET )
@@ -1451,6 +1453,8 @@ accept_mgt_cb(struct ev_loop* loop, struct ev_io* watcher, int revents)
14511453
14521454 pgmoneta_set_proc_title (1 , ai -> argv , "conf set" , NULL );
14531455 reload_set_configuration (NULL , client_fd , compression , encryption , pyl );
1456+ pgmoneta_json_destroy (pyl );
1457+ exit (0 );
14541458 }
14551459 }
14561460 else if (id == MANAGEMENT_STATUS )
@@ -2103,6 +2107,7 @@ accept_management_cb(struct ev_loop* loop, struct ev_io* watcher, int revents)
21032107 shutdown_ports ();
21042108 /* We are leaving the socket descriptor valid such that the client won't reuse it */
21052109 pgmoneta_remote_management (client_fd , addr );
2110+ exit (0 );
21062111 }
21072112
21082113 pgmoneta_disconnect (client_fd );
@@ -2242,8 +2247,9 @@ service_reload_cb(struct ev_loop* loop, ev_signal* w, int revents)
22422247static void
22432248reload_cb (struct ev_loop * loop , ev_signal * w , int revents )
22442249{
2250+ bool restart = false;
22452251 pgmoneta_log_debug ("reload requested (%p, %p, %d)" , loop , w , revents );
2246- reload_configuration ();
2252+ reload_configuration (& restart );
22472253}
22482254
22492255static void
@@ -2470,10 +2476,9 @@ accept_fatal(int error)
24702476 return true;
24712477}
24722478
2473- static bool
2474- reload_configuration (void )
2479+ static void
2480+ reload_configuration (bool * restart )
24752481{
2476- bool restart = false;
24772482 int old_metrics ;
24782483 int old_management ;
24792484 struct main_configuration * config ;
@@ -2483,7 +2488,7 @@ reload_configuration(void)
24832488 old_metrics = config -> metrics ;
24842489 old_management = config -> management ;
24852490
2486- pgmoneta_reload_configuration (& restart );
2491+ pgmoneta_reload_configuration (restart );
24872492
24882493 if (old_metrics != config -> metrics )
24892494 {
@@ -2549,7 +2554,7 @@ reload_configuration(void)
25492554 }
25502555 }
25512556
2552- return restart ;
2557+ return ;
25532558}
25542559
25552560static void
0 commit comments