dhcp: remove old timeout code

There is already the 'no_lease_timeout'.
This commit is contained in:
Beniamino Galvani 2021-11-12 15:49:34 +01:00
parent bce13b0b2f
commit 6ac95047ca
3 changed files with 0 additions and 53 deletions

View file

@ -44,7 +44,6 @@ typedef struct _NMDhcpClientPrivate {
GSource * no_lease_timeout_source;
GSource * ipv6_lladdr_timeout_source;
pid_t pid;
guint timeout_id;
guint watch_id;
NMDhcpState state;
bool iaid_explicit : 1;
@ -165,14 +164,6 @@ reason_to_state(NMDhcpClient *self, const char *iface, const char *reason)
/*****************************************************************************/
static void
timeout_cleanup(NMDhcpClient *self)
{
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
nm_clear_g_source(&priv->timeout_id);
}
static void
watch_cleanup(NMDhcpClient *self)
{
@ -276,8 +267,6 @@ nm_dhcp_client_set_state(NMDhcpClient *self, NMDhcpState new_state, const NML3Co
if (l3cd)
nm_l3_config_data_seal(l3cd);
if (new_state >= NM_DHCP_STATE_BOUND)
timeout_cleanup(self);
if (new_state >= NM_DHCP_STATE_TIMEOUT)
watch_cleanup(self);
@ -372,19 +361,6 @@ nm_dhcp_client_set_state(NMDhcpClient *self, NMDhcpState new_state, const NML3Co
}
}
/* FIXME(l3cfg:dhcp) */
_nm_unused static gboolean
transaction_timeout(gpointer user_data)
{
NMDhcpClient * self = NM_DHCP_CLIENT(user_data);
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
priv->timeout_id = 0;
_LOGW("request timed out");
nm_dhcp_client_set_state(self, NM_DHCP_STATE_TIMEOUT, NULL);
return G_SOURCE_REMOVE;
}
static void
daemon_watch_cb(GPid pid, int status, gpointer user_data)
{
@ -402,21 +378,6 @@ daemon_watch_cb(GPid pid, int status, gpointer user_data)
nm_dhcp_client_set_state(self, NM_DHCP_STATE_TERMINATED, NULL);
}
void
nm_dhcp_client_start_timeout(NMDhcpClient *self)
{
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
g_return_if_fail(priv->timeout_id == 0);
/* Set up a timeout on the transaction to kill it after the timeout */
/* FIXME(l3cfg:dhcp): no-lease-timeout is only for convenience for the user (NMDevice).
* Whatever the purpose of nm_dhcp_client_start_timeout() is, it is not the same timer. */
return;
//priv->timeout_id = g_timeout_add_seconds(priv->no_lease_timeout, transaction_timeout, self);
}
void
nm_dhcp_client_watch_child(NMDhcpClient *self, pid_t pid)
{
@ -425,8 +386,6 @@ nm_dhcp_client_watch_child(NMDhcpClient *self, pid_t pid)
g_return_if_fail(priv->pid == -1);
priv->pid = pid;
nm_dhcp_client_start_timeout(self);
g_return_if_fail(priv->watch_id == 0);
priv->watch_id = g_child_watch_add(pid, daemon_watch_cb, self);
}
@ -440,7 +399,6 @@ nm_dhcp_client_stop_watch_child(NMDhcpClient *self, pid_t pid)
priv->pid = -1;
watch_cleanup(self);
timeout_cleanup(self);
}
gboolean
@ -608,12 +566,6 @@ nm_dhcp_client_start_ip6(NMDhcpClient *self, GError **error)
_set_effective_client_id(self, own_client_id ?: priv->config.client_id, FALSE);
if (priv->config.timeout == NM_DHCP_TIMEOUT_INFINITY)
_LOGI("activation: beginning transaction (no timeout)");
else
_LOGI("activation: beginning transaction (timeout in %u seconds)",
(guint) priv->config.timeout);
addr = ipv6_lladdr_find(self);
if (!addr) {
_LOGD("waiting for IPv6LL address");
@ -1140,7 +1092,6 @@ dispose(GObject *object)
nm_dhcp_client_stop(self, FALSE);
watch_cleanup(self);
timeout_cleanup(self);
nm_clear_g_source_inst(&priv->no_lease_timeout_source);
nm_clear_g_source_inst(&priv->ipv6_lladdr_timeout_source);

View file

@ -1208,8 +1208,6 @@ ip4_start(NMDhcpClient *client, GError **error)
}
_LOGT("dhcp-client4: start " NM_HASH_OBFUSCATE_PTR_FMT, NM_HASH_OBFUSCATE_PTR(priv->client));
nm_dhcp_client_start_timeout(client);
return TRUE;
}

View file

@ -752,7 +752,6 @@ ip4_start(NMDhcpClient *client, GError **error)
return FALSE;
}
nm_dhcp_client_start_timeout(client);
return TRUE;
}
@ -1049,7 +1048,6 @@ ip6_start(NMDhcpClient *client, const struct in6_addr *ll_addr, GError **error)
return FALSE;
}
nm_dhcp_client_start_timeout(client);
return TRUE;
}