Skip to content
Snippets Groups Projects
Commit c75acb40 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

knotc: error code for backgrounded operations

parent af871b78
No related branches found
No related tags found
1 merge request!261knotc: remote messages
......@@ -313,16 +313,17 @@ static int remote_c_zonestatus(server_t *s, remote_cmdargs_t* a)
*/
static int remote_c_refresh(server_t *s, remote_cmdargs_t* a)
{
/* Refresh all. */
dbg_server("remote: %s\n", __func__);
if (a->argc == 0) {
/* Refresh all. */
dbg_server_verb("remote: refreshing all zones\n");
knot_zonedb_foreach(s->zone_db, remote_zone_refresh);
return KNOT_EOK;
} else {
/* Refresh specific zones. */
remote_rdata_apply(s, a, &remote_zone_refresh);
}
/* Refresh specific zones. */
return remote_rdata_apply(s, a, &remote_zone_refresh);
return KNOT_CTL_ACCEPTED;
}
/*!
......@@ -333,14 +334,17 @@ static int remote_c_refresh(server_t *s, remote_cmdargs_t* a)
*/
static int remote_c_retransfer(server_t *s, remote_cmdargs_t* a)
{
/* Refresh all. */
dbg_server("remote: %s\n", __func__);
if (a->argc == 0) {
/* Refresh all. */
return KNOT_ENOTSUP;
} else {
/* Refresh specific zones. */
remote_rdata_apply(s, a, &remote_zone_retransfer);
}
/* Refresh specific zones. */
return remote_rdata_apply(s, a, &remote_zone_retransfer);
return KNOT_CTL_ACCEPTED;
}
/*!
......@@ -352,24 +356,24 @@ static int remote_c_retransfer(server_t *s, remote_cmdargs_t* a)
*/
static int remote_c_flush(server_t *s, remote_cmdargs_t* a)
{
/* Flush all. */
dbg_server("remote: %s\n", __func__);
if (a->argc == 0) {
int ret = 0;
/* Flush all. */
dbg_server_verb("remote: flushing all zones\n");
rcu_read_lock();
knot_zonedb_iter_t it;
knot_zonedb_iter_begin(s->zone_db, &it);
while(!knot_zonedb_iter_finished(&it)) {
ret = remote_zone_flush(knot_zonedb_iter_val(&it));
remote_zone_flush(knot_zonedb_iter_val(&it));
knot_zonedb_iter_next(&it);
}
rcu_read_unlock();
return ret;
} else {
/* Flush specific zones. */
remote_rdata_apply(s, a, &remote_zone_flush);
}
/* Flush specific zones. */
return remote_rdata_apply(s, a, &remote_zone_flush);
return KNOT_CTL_ACCEPTED;
}
/*!
......@@ -381,10 +385,14 @@ static int remote_c_signzone(server_t *server, remote_cmdargs_t* arguments)
dbg_server("remote: %s\n", __func__);
if (arguments->argc == 0) {
/* Resign all. */
return KNOT_ENOTSUP;
} else {
/* Resign specific zones. */
remote_rdata_apply(server, arguments, remote_zone_sign);
}
return remote_rdata_apply(server, arguments, remote_zone_sign);
return KNOT_CTL_ACCEPTED;
}
/*!
......
......@@ -81,6 +81,7 @@ const error_table_t error_messages[] = {
/* Control states. */
{ KNOT_CTL_STOP, "Stopping server" },
{ KNOT_CTL_ACCEPTED, "command accepted" },
/* Network errors. */
{ KNOT_NET_EADDR, "Bad address or host name" },
......
......@@ -97,6 +97,7 @@ enum knot_error {
/* Control states. */
KNOT_CTL_STOP,
KNOT_CTL_ACCEPTED,
/* Network errors. */
KNOT_NET_EADDR,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment