Commit 9b098d2d authored by Daniel Salzman's avatar Daniel Salzman

server: remove useless return value for reconfigure functions

parent 7fb87516
......@@ -604,10 +604,10 @@ static int reconfigure_rate_limits(conf_t *conf, server_t *server)
return KNOT_EOK;
}
int server_reconfigure(conf_t *conf, server_t *server)
void server_reconfigure(conf_t *conf, server_t *server)
{
if (server == NULL) {
return KNOT_EINVAL;
if (conf == NULL || server == NULL) {
return;
}
/* First reconfiguration. */
......@@ -616,25 +616,23 @@ int server_reconfigure(conf_t *conf, server_t *server)
}
/* Reconfigure rate limits. */
int ret = KNOT_EOK;
int ret;
if ((ret = reconfigure_rate_limits(conf, server)) < 0) {
log_error("failed to reconfigure rate limits");
return ret;
log_error("failed to reconfigure rate limits (%s)",
knot_strerror(ret));
}
/* Reconfigure server threads. */
if ((ret = reconfigure_threads(conf, server)) < 0) {
log_error("failed to reconfigure server threads");
return ret;
log_error("failed to reconfigure server threads (%s)",
knot_strerror(ret));
}
/* Update bound sockets. */
if ((ret = reconfigure_sockets(conf, server)) < 0) {
log_error("failed to reconfigure server sockets");
return ret;
log_error("failed to reconfigure server sockets (%s)",
knot_strerror(ret));
}
return ret;
}
static void reopen_timers_database(conf_t *conf, server_t *server)
......@@ -656,8 +654,12 @@ static void reopen_timers_database(conf_t *conf, server_t *server)
}
}
int server_update_zones(conf_t *conf, server_t *server)
void server_update_zones(conf_t *conf, server_t *server)
{
if (conf == NULL || server == NULL) {
return;
}
/* Prevent emitting of new zone events. */
if (server->zone_db) {
knot_zonedb_foreach(server->zone_db, zone_events_freeze);
......@@ -670,7 +672,7 @@ int server_update_zones(conf_t *conf, server_t *server)
/* Reload zone database and free old zones. */
reopen_timers_database(conf, server);
int ret = zonedb_reload(conf, server);
zonedb_reload(conf, server);
/* Trim extra heap. */
mem_trim();
......@@ -680,8 +682,6 @@ int server_update_zones(conf_t *conf, server_t *server)
if (server->zone_db) {
knot_zonedb_foreach(server->zone_db, zone_events_start);
}
return ret;
}
ref_t *server_set_ifaces(server_t *server, fdset_t *fds, int index, int thread_id)
......
......@@ -172,22 +172,15 @@ void server_stop(server_t *server);
* \brief Server reconfiguration routine.
*
* Routine for dynamic server reconfiguration.
*
* \retval KNOT_EOK on success.
* \retval KNOT_ENOTRUNNING if the server is not running.
* \retval KNOT_EINVAL on invalid parameters.
* \retval KNOT_ERROR unspecified error.
*/
int server_reconfigure(conf_t *conf, server_t *data);
void server_reconfigure(conf_t *conf, server_t *data);
/*!
* \brief Reconfigure zone database.
*
* Routine for dynamic server reconfiguration.
*
* \return KNOT_EOK on success or KNOT_ error
* Routine for dynamic server zones reconfiguration.
*/
int server_update_zones(conf_t *conf, server_t *server);
void server_update_zones(conf_t *conf, server_t *server);
/*!
* \brief Update fdsets from current interfaces list.
......
......@@ -26,8 +26,6 @@
#include "knot/common/log.h"
#include "libknot/libknot.h"
/*- zone file status --------------------------------------------------------*/
/*!
* \brief Zone file status.
*/
......@@ -78,8 +76,6 @@ static zone_status_t zone_file_status(const zone_t *old_zone, conf_t *conf,
}
}
/*- zone loading/updating ---------------------------------------------------*/
/*!
* \brief Log message about loaded zone (name and status).
*
......@@ -318,10 +314,10 @@ static knot_zonedb_t *create_zonedb(conf_t *conf, server_t *server)
* \param db_new New zone database.
* \param db_old Old zone database.
*/
static int remove_old_zonedb(const knot_zonedb_t *db_new, knot_zonedb_t *db_old)
static void remove_old_zonedb(const knot_zonedb_t *db_new, knot_zonedb_t *db_old)
{
if (db_old == NULL) {
return KNOT_EOK;
return;
}
knot_zonedb_iter_t it;
......@@ -339,27 +335,20 @@ static int remove_old_zonedb(const knot_zonedb_t *db_new, knot_zonedb_t *db_old)
}
knot_zonedb_deep_free(&db_old);
return KNOT_EOK;
}
/*- public API functions ----------------------------------------------------*/
/*!
* \brief Update zone database according to configuration.
*/
int zonedb_reload(conf_t *conf, server_t *server)
void zonedb_reload(conf_t *conf, server_t *server)
{
/* Check parameters */
if (conf == NULL || server == NULL) {
return KNOT_EINVAL;
return;
}
/* Insert all required zones to the new zone DB. */
knot_zonedb_t *db_new = create_zonedb(conf, server);
if (db_new == NULL) {
log_error("failed to create new zone database");
return KNOT_ENOMEM;
return;
}
/* Rebuild zone database search stack. */
......@@ -380,5 +369,5 @@ int zonedb_reload(conf_t *conf, server_t *server)
* No new thread can access these zones in the old DB, as the
* databases are already switched.
*/
return remove_old_zonedb(db_new, db_old);
remove_old_zonedb(db_new, db_old);
}
......@@ -24,9 +24,5 @@
*
* \param[in] conf Configuration.
* \param[in] server Server instance.
*
* \retval KNOT_EOK
* \retval KNOT_EINVAL
* \retval KNOT_ERROR
*/
int zonedb_reload(conf_t *conf, server_t *server);
void zonedb_reload(conf_t *conf, server_t *server);
......@@ -456,7 +456,6 @@ int main(int argc, char **argv)
/* Reconfigure server interfaces.
* @note This MUST be done before we drop privileges. */
server_reconfigure(conf(), &server);
log_info("configured %zu zones", conf_id_count(conf(), C_ZONE));
/* Alter privileges. */
int uid, gid;
......@@ -497,7 +496,7 @@ int main(int argc, char **argv)
rcu_register_thread();
/* Populate zone database. */
log_info("loading zones");
log_info("loading %zu zones", conf_id_count(conf(), C_ZONE));
server_update_zones(conf(), &server);
/* Check number of loaded zones. */
......
......@@ -23,10 +23,9 @@
extern void udp_master_init_stdio(server_t *server);
int server_reconfigure(conf_t *conf, server_t *server)
void server_reconfigure(conf_t *conf, server_t *server)
{
log_info("AFL, Wrap server_reconfigure()");
int ret = _orig_server_reconfigure(conf, server);
_orig_server_reconfigure(conf, server);
udp_master_init_stdio(server);
return ret;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment