2005-02-21 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerDHCP.[ch]
		- (nm_device_dhcp_remove_timeouts): new function

	* src/NetworkManagerDevice.c
		- Use nm_device_dhcp_remove_timeouts() everywhere that we need to
			remove the DHCP timeouts.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@466 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2005-02-22 00:30:46 +00:00
parent 8eed3ac89b
commit d7bd32d03c
4 changed files with 39 additions and 29 deletions

View File

@@ -1,3 +1,12 @@
2005-02-21 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerDHCP.[ch]
- (nm_device_dhcp_remove_timeouts): new function
* src/NetworkManagerDevice.c
- Use nm_device_dhcp_remove_timeouts() everywhere that we need to
remove the DHCP timeouts.
2005-02-21 Dan Williams <dcbw@redhat.com>
* panel-applet/NMWirelessApplet.[ch]

View File

@@ -304,6 +304,30 @@ gboolean nm_device_dhcp_setup_timeouts (NMDevice *dev)
}
/*
* nm_device_dhcp_remove_timeouts
*
* Remove the DHCP renew and rebind timeouts for a device.
*
*/
void nm_device_dhcp_remove_timeouts (NMDevice *dev)
{
g_return_if_fail (dev != NULL);
if (dev->renew_timeout > 0)
{
g_source_destroy (g_main_context_find_source_by_id (dev->context, dev->renew_timeout));
dev->renew_timeout = 0;
}
if (dev->rebind_timeout > 0)
{
g_source_destroy (g_main_context_find_source_by_id (dev->context, dev->rebind_timeout));
dev->renew_timeout = 0;
}
}
/*
* nm_device_dhcp_renew
*

View File

@@ -27,6 +27,7 @@
int nm_device_dhcp_request (NMDevice *dev);
void nm_device_dhcp_cease (NMDevice *dev);
gboolean nm_device_dhcp_setup_timeouts (NMDevice *dev);
void nm_device_dhcp_remove_timeouts(NMDevice *dev);
gboolean nm_device_dhcp_renew (gpointer user_data);
gboolean nm_device_dhcp_rebind (gpointer user_data);
gboolean nm_device_do_autoip (NMDevice *dev);

View File

@@ -433,25 +433,9 @@ static gpointer nm_device_worker (gpointer user_data)
g_main_loop_run (dev->loop);
if (nm_device_config_get_use_dhcp (dev))
{
if (dev->renew_timeout > 0)
g_source_remove (dev->renew_timeout);
if (dev->rebind_timeout > 0)
g_source_remove (dev->rebind_timeout);
}
/* Remove any DHCP timeouts that might have been running */
if (dev->renew_timeout)
{
g_source_remove (dev->renew_timeout);
dev->renew_timeout = 0;
}
if (dev->rebind_timeout)
{
g_source_remove (dev->rebind_timeout);
dev->rebind_timeout = 0;
}
if (nm_device_config_get_use_dhcp (dev))
nm_device_dhcp_remove_timeouts (dev);
g_main_loop_unref (dev->loop);
g_main_context_unref (dev->context);
@@ -2526,17 +2510,9 @@ gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added)
if (nm_device_get_driver_support_level (dev) == NM_DRIVER_UNSUPPORTED)
return (TRUE);
/* Remove any DHCP timeouts we may have had running */
if (dev->renew_timeout > 0)
{
g_source_remove (dev->renew_timeout);
dev->renew_timeout = 0;
}
if (dev->rebind_timeout > 0)
{
g_source_remove (dev->rebind_timeout);
dev->rebind_timeout = 0;
}
/* Remove any DHCP timeouts that might have been running */
if (nm_device_config_get_use_dhcp (dev))
nm_device_dhcp_remove_timeouts (dev);
/* Take out any entries in the routing table and any IP address the device had. */
nm_system_device_flush_routes (dev);