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/network/networkd-lldp-tx.c | |
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/network/networkd-lldp-tx.c')
-rw-r--r-- | src/network/networkd-lldp-tx.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/network/networkd-lldp-tx.c b/src/network/networkd-lldp-tx.c index 9e0b447524..16147b9c7a 100644 --- a/src/network/networkd-lldp-tx.c +++ b/src/network/networkd-lldp-tx.c @@ -332,7 +332,7 @@ static int link_send_lldp(Link *link) { static int on_lldp_timer(sd_event_source *s, usec_t t, void *userdata) { Link *link = userdata; - usec_t current, delay, next; + usec_t delay; int r; assert(s); @@ -347,12 +347,10 @@ static int on_lldp_timer(sd_event_source *s, usec_t t, void *userdata) { if (link->lldp_tx_fast > 0) link->lldp_tx_fast--; - assert_se(sd_event_now(sd_event_source_get_event(s), clock_boottime_or_monotonic(), ¤t) >= 0); - delay = link->lldp_tx_fast > 0 ? LLDP_FAST_TX_USEC : LLDP_TX_INTERVAL_USEC; - next = usec_add(usec_add(current, delay), (usec_t) random_u64() % LLDP_JITTER_USEC); + delay = usec_add(delay, (usec_t) random_u64() % LLDP_JITTER_USEC); - r = sd_event_source_set_time(s, next); + r = sd_event_source_set_time_relative(s, delay); if (r < 0) return log_link_error_errno(link, r, "Failed to restart LLDP timer: %m"); |