sd-dhcp-client: don't log timeouts if already expired
This commit is contained in:
parent
e3284031ae
commit
f3bd46c657
|
@ -1712,13 +1712,13 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
log_dhcp_client(client, "lease expires in %s",
|
|
||||||
format_timespan(time_string, FORMAT_TIMESPAN_MAX, lifetime_timeout - time_now, USEC_PER_SEC));
|
|
||||||
|
|
||||||
/* don't arm earlier timeouts if this has already expired */
|
/* don't arm earlier timeouts if this has already expired */
|
||||||
if (lifetime_timeout <= time_now)
|
if (lifetime_timeout <= time_now)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
log_dhcp_client(client, "lease expires in %s",
|
||||||
|
format_timespan(time_string, FORMAT_TIMESPAN_MAX, lifetime_timeout - time_now, USEC_PER_SEC));
|
||||||
|
|
||||||
/* arm T2 timeout */
|
/* arm T2 timeout */
|
||||||
r = event_reset_time(client->event, &client->timeout_t2,
|
r = event_reset_time(client->event, &client->timeout_t2,
|
||||||
clock_boottime_or_monotonic(),
|
clock_boottime_or_monotonic(),
|
||||||
|
@ -1728,13 +1728,13 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
log_dhcp_client(client, "T2 expires in %s",
|
|
||||||
format_timespan(time_string, FORMAT_TIMESPAN_MAX, t2_timeout - time_now, USEC_PER_SEC));
|
|
||||||
|
|
||||||
/* don't arm earlier timeout if this has already expired */
|
/* don't arm earlier timeout if this has already expired */
|
||||||
if (t2_timeout <= time_now)
|
if (t2_timeout <= time_now)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
log_dhcp_client(client, "T2 expires in %s",
|
||||||
|
format_timespan(time_string, FORMAT_TIMESPAN_MAX, t2_timeout - time_now, USEC_PER_SEC));
|
||||||
|
|
||||||
/* arm T1 timeout */
|
/* arm T1 timeout */
|
||||||
r = event_reset_time(client->event, &client->timeout_t1,
|
r = event_reset_time(client->event, &client->timeout_t1,
|
||||||
clock_boottime_or_monotonic(),
|
clock_boottime_or_monotonic(),
|
||||||
|
@ -1744,8 +1744,9 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
log_dhcp_client(client, "T1 expires in %s",
|
if (t1_timeout > time_now)
|
||||||
format_timespan(time_string, FORMAT_TIMESPAN_MAX, t1_timeout - time_now, USEC_PER_SEC));
|
log_dhcp_client(client, "T1 expires in %s",
|
||||||
|
format_timespan(time_string, FORMAT_TIMESPAN_MAX, t1_timeout - time_now, USEC_PER_SEC));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue