mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-08 23:10:29 +01:00
core/dhcp: reduce the wait time when killing dhcp client process
We kill the dhcp process synchronously, so waiting for up to 3 seconds is really painful. Instead, give the client only 0.5 to terminate before sending SIGKILL. The proper solution would be to kill it asynchronously and dhcp manager making sure that it does not start a new instance before the old process was killed. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
4bfb430db7
commit
f56c82d861
3 changed files with 7 additions and 7 deletions
|
|
@ -135,9 +135,9 @@ watch_cleanup (NMDHCPClient *self)
|
|||
}
|
||||
|
||||
void
|
||||
nm_dhcp_client_stop_pid (GPid pid, const char *iface, guint timeout_secs)
|
||||
nm_dhcp_client_stop_pid (GPid pid, const char *iface)
|
||||
{
|
||||
int i = (timeout_secs ? timeout_secs : 3) * 5; /* default 3 seconds */
|
||||
int i = 5; /* roughly 0.5 seconds */
|
||||
|
||||
g_return_if_fail (pid > 0);
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ nm_dhcp_client_stop_pid (GPid pid, const char *iface, guint timeout_secs)
|
|||
break;
|
||||
}
|
||||
}
|
||||
g_usleep (G_USEC_PER_SEC / 5);
|
||||
g_usleep (G_USEC_PER_SEC / 10);
|
||||
}
|
||||
|
||||
if (i <= 0) {
|
||||
|
|
@ -193,7 +193,7 @@ stop (NMDHCPClient *self, gboolean release, const GByteArray *duid)
|
|||
/* Clean up the watch handler since we're explicitly killing the daemon */
|
||||
watch_cleanup (self);
|
||||
|
||||
nm_dhcp_client_stop_pid (priv->pid, priv->iface, 0);
|
||||
nm_dhcp_client_stop_pid (priv->pid, priv->iface);
|
||||
|
||||
priv->info_only = FALSE;
|
||||
}
|
||||
|
|
@ -518,7 +518,7 @@ nm_dhcp_client_stop_existing (const char *pid_file, const char *binary_name)
|
|||
exe = proc_contents;
|
||||
|
||||
if (!strcmp (exe, binary_name))
|
||||
nm_dhcp_client_stop_pid ((GPid) tmp, NULL, 0);
|
||||
nm_dhcp_client_stop_pid ((GPid) tmp, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ NMIP6Config *nm_dhcp_client_get_ip6_config (NMDHCPClient *self, gboolean test)
|
|||
/* Backend helpers */
|
||||
void nm_dhcp_client_stop_existing (const char *pid_file, const char *binary_name);
|
||||
|
||||
void nm_dhcp_client_stop_pid (GPid pid, const char *iface, guint timeout_secs);
|
||||
void nm_dhcp_client_stop_pid (GPid pid, const char *iface);
|
||||
|
||||
#endif /* NM_DHCP_CLIENT_H */
|
||||
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ stop (NMDHCPClient *client, gboolean release, const GByteArray *duid)
|
|||
rpid = dhclient_start (client, NULL, duid, TRUE);
|
||||
if (rpid > 0) {
|
||||
/* Wait a few seconds for the release to happen */
|
||||
nm_dhcp_client_stop_pid (rpid, nm_dhcp_client_get_iface (client), 5);
|
||||
nm_dhcp_client_stop_pid (rpid, nm_dhcp_client_get_iface (client));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue