summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/NetworkManagerUtils.h19
-rw-r--r--src/ppp/nm-ppp-manager.c3
2 files changed, 21 insertions, 1 deletions
diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h
index b8d3a4f064..b26d08bdce 100644
--- a/src/NetworkManagerUtils.h
+++ b/src/NetworkManagerUtils.h
@@ -56,6 +56,25 @@ int nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
/*****************************************************************************/
+/* during shutdown, there are two relevant timeouts. One is
+ * NM_SHUTDOWN_TIMEOUT_MS which is plenty of time, that we give for all
+ * actions to complete. Of course, during shutdown components should hurry
+ * to cleanup.
+ *
+ * When we initiate shutdown, we should start killing child processes
+ * with SIGTERM. If they don't complete within NM_SHUTDOWN_TIMEOUT_MS, we send
+ * SIGKILL.
+ *
+ * After NM_SHUTDOWN_TIMEOUT_MS, NetworkManager will however not yet terminate right
+ * away. It iterates the mainloop for another NM_SHUTDOWN_TIMEOUT_MS_EXTRA. This
+ * should give time to reap the child process (after SIGKILL).
+ *
+ * So, the maxiumum time we should wait before sending SIGKILL should be at most
+ * NM_SHUTDOWN_TIMEOUT_MS.
+ */
+#define NM_SHUTDOWN_TIMEOUT_MS 1500
+#define NM_SHUTDOWN_TIMEOUT_MS_WATCHDOG 500
+
typedef struct _NMShutdownWaitObjHandle NMShutdownWaitObjHandle;
NMShutdownWaitObjHandle *_nm_shutdown_wait_obj_register (GObject *watched_obj,
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index e7de5d4a2e..fc658bec93 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -1253,7 +1253,8 @@ _ppp_manager_stop (NMPPPManager *self,
handle->shutdown_waitobj = g_object_new (G_TYPE_OBJECT, NULL);
nm_shutdown_wait_obj_register (handle->shutdown_waitobj, "ppp-manager-wait-kill-pppd");
nm_utils_kill_child_async (nm_steal_int (&priv->pid),
- SIGTERM, LOGD_PPP, "pppd", 2000,
+ SIGTERM, LOGD_PPP, "pppd",
+ NM_SHUTDOWN_TIMEOUT_MS,
_stop_child_cb, handle);
return handle;