2006-03-22 Robert Love <rml@novell.com>

* src/dhcp-manager/nm-dhcp-manager.c: Create NM_DHCP_TIMEOUT
	  preprocessor define and use it instead of open-coded the DHCP
	  timeout, which is currently 25 seconds, everywhere.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1629 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love
2006-03-22 21:08:56 +00:00
committed by Robert Love
parent db98fe8137
commit a82dd957f6
2 changed files with 12 additions and 3 deletions

View File

@@ -33,6 +33,8 @@
#include "nm-utils.h"
#define NM_DHCP_TIMEOUT 25 /* DHCP timeout, in seconds */
struct NMDHCPManager
{
NMData * data;
@@ -172,7 +174,8 @@ static gboolean nm_dhcp_manager_handle_timeout (NMActRequest *req)
dev = nm_act_request_get_dev (req);
g_assert (dev);
nm_info ("Device '%s' DHCP transaction took too long (>25s), stopping it.", nm_device_get_iface (dev));
nm_info ("Device '%s' DHCP transaction took too long (>%ds), stopping it.",
nm_device_get_iface (dev), NM_DHCP_TIMEOUT);
if (nm_act_request_get_stage (req) == NM_ACT_STAGE_IP_CONFIG_START)
{
@@ -238,8 +241,8 @@ gboolean nm_dhcp_manager_begin_transaction (NMDHCPManager *manager, NMActRequest
return FALSE;
}
/* Set up a timeout on the transaction to kill it after 25s */
source = g_timeout_source_new (25000);
/* Set up a timeout on the transaction to kill it after NM_DHCP_TIMEOUT seconds */
source = g_timeout_source_new (NM_DHCP_TIMEOUT * 1000);
g_source_set_callback (source, (GSourceFunc) nm_dhcp_manager_handle_timeout, req, NULL);
nm_act_request_set_dhcp_timeout (req, g_source_attach (source, manager->data->main_context));
g_source_unref (source);