summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-06 16:59:48 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-11 15:06:22 +0200
commit902bb5d8abb2a7d258741828d212ca549ab16950 (patch)
treeab3ce83fe40ca0e0d056003e54f0dc4029e8c315 /src/resolve/resolved-bus.c
parent82bd6dddc4a363a9c3c6f41eb46eb171a80dca27 (diff)
resolved: verify all RRs when we come back from suspend
Diffstat (limited to 'src/resolve/resolved-bus.c')
-rw-r--r--src/resolve/resolved-bus.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 6a3343e000..cfe12d3bed 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -638,6 +638,28 @@ static int on_bus_retry(sd_event_source *s, usec_t usec, void *userdata) {
return 0;
}
+static int match_prepare_for_sleep(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *ret_error) {
+ Manager *m = userdata;
+ int b, r;
+
+ assert(bus);
+ assert(bus);
+
+ r = sd_bus_message_read(message, "b", &b);
+ if (r < 0) {
+ log_debug("Failed to parse PrepareForSleep signal: %s", strerror(-r));
+ return 0;
+ }
+
+ if (b)
+ return 0;
+
+ log_debug("Coming back from suspend, verifying all RRs...");
+
+ manager_verify_all(m);
+ return 0;
+}
+
int manager_connect_bus(Manager *m) {
int r;
@@ -681,5 +703,16 @@ int manager_connect_bus(Manager *m) {
return r;
}
+ r = sd_bus_add_match(m->bus, &m->prepare_for_sleep_slot,
+ "type='signal',"
+ "sender='org.freedesktop.login1',"
+ "interface='org.freedesktop.login1.Manager',"
+ "member='PrepareForSleep',"
+ "path='/org/freedesktop/login1'",
+ match_prepare_for_sleep,
+ m);
+ if (r < 0)
+ log_error("Failed to add match for PrepareForSleep: %s", strerror(-r));
+
return 0;
}