summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-01-29 07:26:58 +0100
committerTom Gundersen <teg@jklm.no>2015-01-31 15:26:08 +0100
commit233ba5c3a0f73e01fe6149fd8c377826a83c2a0a (patch)
tree9ddd7b42550e4b708244e86cb8557039f293277c
parent81f5fc2d43800c23a4440ed94cfe38d579e896fe (diff)
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.
-rw-r--r--src/libsystemd/sd-rtnl/sd-rtnl.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index 5778ea53c0..7f1ec308a8 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -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) {