diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-07-28 11:18:26 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-07-28 11:24:55 +0200 |
commit | 39cf0351c529584aa8f270e3b418d7ab9461b622 (patch) | |
tree | 11c5fcdc23e9f6f8b9d9782878fd542fa42f3f2c /src/socket-proxy | |
parent | man: document new relative time APIs in sd-event (diff) | |
download | systemd-39cf0351c529584aa8f270e3b418d7ab9461b622.tar.xz systemd-39cf0351c529584aa8f270e3b418d7ab9461b622.zip |
tree-wide: make use of new relative time events in sd-event.h
Diffstat (limited to 'src/socket-proxy')
-rw-r--r-- | src/socket-proxy/socket-proxyd.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c index b461aead60..50f5b9c9c5 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -95,16 +95,14 @@ static int idle_time_cb(sd_event_source *s, uint64_t usec, void *userdata) { } static int connection_release(Connection *c) { - int r; Context *context = c->context; - usec_t idle_instant; + int r; connection_free(c); if (arg_exit_idle_time < USEC_INFINITY && set_isempty(context->connections)) { - idle_instant = usec_add(now(CLOCK_MONOTONIC), arg_exit_idle_time); if (context->idle_time) { - r = sd_event_source_set_time(context->idle_time, idle_instant); + r = sd_event_source_set_time_relative(context->idle_time, arg_exit_idle_time); if (r < 0) return log_error_errno(r, "Error while setting idle time: %m"); @@ -112,8 +110,9 @@ static int connection_release(Connection *c) { if (r < 0) return log_error_errno(r, "Error while enabling idle time: %m"); } else { - r = sd_event_add_time(context->event, &context->idle_time, CLOCK_MONOTONIC, - idle_instant, 0, idle_time_cb, context); + r = sd_event_add_time_relative( + context->event, &context->idle_time, CLOCK_MONOTONIC, + arg_exit_idle_time, 0, idle_time_cb, context); if (r < 0) return log_error_errno(r, "Failed to create idle timer: %m"); } |