summaryrefslogtreecommitdiffstats
path: root/src/libsystemd
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-03 17:05:16 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-05 05:19:02 +0100
commitb3ae7237c6cc84953759280ab3fd95933ede7390 (patch)
treedf3f7e714fd395dbbe206d321a554f4e0dbe28e1 /src/libsystemd
parentsd-resolve: introduce sd_resolve_query_{get,set}_destroy_callback() (diff)
downloadsystemd-b3ae7237c6cc84953759280ab3fd95933ede7390.tar.xz
systemd-b3ae7237c6cc84953759280ab3fd95933ede7390.zip
sd-resolve: introduce sd_resolve_query_{get,set}_floating()
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-resolve/sd-resolve.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libsystemd/sd-resolve/sd-resolve.c b/src/libsystemd/sd-resolve/sd-resolve.c
index dd33314f53..1fbab9dbf9 100644
--- a/src/libsystemd/sd-resolve/sd-resolve.c
+++ b/src/libsystemd/sd-resolve/sd-resolve.c
@@ -1157,6 +1157,34 @@ _public_ int sd_resolve_query_set_destroy_callback(sd_resolve_query *q, sd_resol
return 0;
}
+_public_ int sd_resolve_query_get_floating(sd_resolve_query *q) {
+ assert_return(q, -EINVAL);
+
+ return q->floating;
+}
+
+_public_ int sd_resolve_query_set_floating(sd_resolve_query *q, int b) {
+ assert_return(q, -EINVAL);
+
+ if (q->floating == !!b)
+ return 0;
+
+ if (!q->resolve) /* Already disconnected */
+ return -ESTALE;
+
+ q->floating = b;
+
+ if (b) {
+ sd_resolve_query_ref(q);
+ sd_resolve_unref(q->resolve);
+ } else {
+ sd_resolve_ref(q->resolve);
+ sd_resolve_query_unref(q);
+ }
+
+ return 1;
+}
+
static int io_callback(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
sd_resolve *resolve = userdata;
int r;