Since NM now handles long-running dispatcher scripts better, allow them to run for really long times.
This commit is contained in:
@@ -383,6 +383,8 @@ child_setup (gpointer user_data G_GNUC_UNUSED)
|
|||||||
setpgid (pid, pid);
|
setpgid (pid, pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SCRIPT_TIMEOUT 600 /* 10 minutes */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dispatch_one_script (Request *request)
|
dispatch_one_script (Request *request)
|
||||||
{
|
{
|
||||||
@@ -400,7 +402,7 @@ dispatch_one_script (Request *request)
|
|||||||
|
|
||||||
if (g_spawn_async ("/", argv, request->envp, G_SPAWN_DO_NOT_REAP_CHILD, child_setup, request, &script->pid, &error)) {
|
if (g_spawn_async ("/", argv, request->envp, G_SPAWN_DO_NOT_REAP_CHILD, child_setup, request, &script->pid, &error)) {
|
||||||
request->script_watch_id = g_child_watch_add (script->pid, (GChildWatchFunc) script_watch_cb, script);
|
request->script_watch_id = g_child_watch_add (script->pid, (GChildWatchFunc) script_watch_cb, script);
|
||||||
request->script_timeout_id = g_timeout_add_seconds (20, script_timeout_cb, script);
|
request->script_timeout_id = g_timeout_add_seconds (SCRIPT_TIMEOUT, script_timeout_cb, script);
|
||||||
} else {
|
} else {
|
||||||
g_warning ("Failed to execute script '%s': (%d) %s",
|
g_warning ("Failed to execute script '%s': (%d) %s",
|
||||||
script->script, error->code, error->message);
|
script->script, error->code, error->message);
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
#include "nm-dbus-glib-types.h"
|
#include "nm-dbus-glib-types.h"
|
||||||
#include "nm-glib-compat.h"
|
#include "nm-glib-compat.h"
|
||||||
|
|
||||||
|
#define CALL_TIMEOUT (1000 * 60 * 10) /* 10 mintues for all scripts */
|
||||||
|
|
||||||
static gboolean do_dispatch = TRUE;
|
static gboolean do_dispatch = TRUE;
|
||||||
static GHashTable *requests = NULL;
|
static GHashTable *requests = NULL;
|
||||||
|
|
||||||
@@ -428,7 +430,7 @@ _dispatcher_call (DispatcherAction action,
|
|||||||
GPtrArray *results = NULL;
|
GPtrArray *results = NULL;
|
||||||
|
|
||||||
success = dbus_g_proxy_call_with_timeout (proxy, "Action",
|
success = dbus_g_proxy_call_with_timeout (proxy, "Action",
|
||||||
30000,
|
CALL_TIMEOUT,
|
||||||
&error,
|
&error,
|
||||||
G_TYPE_STRING, action_to_string (action),
|
G_TYPE_STRING, action_to_string (action),
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash,
|
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash,
|
||||||
@@ -461,7 +463,7 @@ _dispatcher_call (DispatcherAction action,
|
|||||||
dispatcher_done_cb,
|
dispatcher_done_cb,
|
||||||
info,
|
info,
|
||||||
(GDestroyNotify) dispatcher_info_cleanup,
|
(GDestroyNotify) dispatcher_info_cleanup,
|
||||||
30000,
|
CALL_TIMEOUT,
|
||||||
G_TYPE_STRING, action_to_string (action),
|
G_TYPE_STRING, action_to_string (action),
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash,
|
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash,
|
||||||
DBUS_TYPE_G_MAP_OF_VARIANT, connection_props,
|
DBUS_TYPE_G_MAP_OF_VARIANT, connection_props,
|
||||||
|
Reference in New Issue
Block a user