mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-10 01:17:44 +03:00
sd-rtnl: don't fail event handler when callback fails
As in sd-bus, simply log at debug level when a callback fails, but don't fail the event handler. Otherwise any error returned by any callback will disable the rtnl event handler. We should only do that on serious internal errors in sd-rtnl that we know cannot be recovered from.
This commit is contained in:
parent
81f5fc2d43
commit
233ba5c3a0
@ -379,9 +379,12 @@ static int process_timeout(sd_rtnl *rtnl) {
|
||||
hashmap_remove(rtnl->reply_callbacks, &c->serial);
|
||||
|
||||
r = c->callback(rtnl, m, c->userdata);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "sd-rtnl: timedout callback failed: %m");
|
||||
|
||||
free(c);
|
||||
|
||||
return r < 0 ? r : 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
|
||||
@ -404,9 +407,12 @@ static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
|
||||
prioq_remove(rtnl->reply_callbacks_prioq, c, &c->prioq_idx);
|
||||
|
||||
r = c->callback(rtnl, m, c->userdata);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "sd-rtnl: callback failed: %m");
|
||||
|
||||
free(c);
|
||||
|
||||
return r;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
|
||||
@ -424,12 +430,16 @@ static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
|
||||
LIST_FOREACH(match_callbacks, c, rtnl->match_callbacks) {
|
||||
if (type == c->type) {
|
||||
r = c->callback(rtnl, m, c->userdata);
|
||||
if (r != 0)
|
||||
return r;
|
||||
if (r != 0) {
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "sd-rtnl: match callback failed: %m");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int process_running(sd_rtnl *rtnl, sd_rtnl_message **ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user