summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-client.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-08-28 15:46:29 +0200
committerTom Gundersen <teg@jklm.no>2014-08-28 21:19:17 +0200
commit9021bb9f935c93b516b10c88db2a212a9e3a8140 (patch)
tree812f2077c86db0d38da59649b03d0728ddd363a0 /src/libsystemd-network/sd-dhcp-client.c
parent752bbf75b9b52c0faae29bb4b77a99c4bb0d298f (diff)
sd-event: name event sources used in libraries
This should help in debugging failing event sources.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 8a9887d19f..7cf1b80d29 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -700,6 +700,11 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
if (r < 0)
goto error;
+ r = sd_event_source_set_name(client->timeout_resend,
+ "dhcp4-resend-timer");
+ if (r < 0)
+ goto error;
+
switch (client->state) {
case DHCP_STATE_INIT:
r = client_send_discover(client);
@@ -773,6 +778,11 @@ static int client_initialize_io_events(sd_dhcp_client *client,
if (r < 0)
goto error;
+ r = sd_event_source_set_name(client->receive_message,
+ "dhcp4-receive-message");
+ if (r < 0)
+ goto error;
+
error:
if (r < 0)
client_stop(client, r);
@@ -799,6 +809,11 @@ static int client_initialize_time_events(sd_dhcp_client *client) {
r = sd_event_source_set_priority(client->timeout_resend,
client->event_priority);
+ r = sd_event_source_set_name(client->timeout_resend,
+ "dhcp4-resend-timer");
+ if (r < 0)
+ goto error;
+
error:
if (r < 0)
client_stop(client, r);
@@ -1107,6 +1122,11 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->timeout_expire,
+ "dhcp4-lifetime");
+ if (r < 0)
+ return r;
+
log_dhcp_client(client, "lease expires in %s",
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
lifetime_timeout - time_now, 0));
@@ -1130,6 +1150,11 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->timeout_t2,
+ "dhcp4-t2-timeout");
+ if (r < 0)
+ return r;
+
log_dhcp_client(client, "T2 expires in %s",
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
t2_timeout - time_now, 0));
@@ -1152,6 +1177,11 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->timeout_t1,
+ "dhcp4-t1-timer");
+ if (r < 0)
+ return r;
+
log_dhcp_client(client, "T1 expires in %s",
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
t1_timeout - time_now, 0));
@@ -1192,6 +1222,11 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message,
client->event_priority);
if (r < 0)
goto error;
+
+ r = sd_event_source_set_name(client->timeout_resend,
+ "dhcp4-resend-timer");
+ if (r < 0)
+ goto error;
} else if (r == -ENOMSG)
/* invalid message, let's ignore it */
return 0;