1
1
=== modified file 'src/nm-device-wifi.c'
3
src/nm-device-ethernet.c | 4 ++--
4
src/nm-device-wifi.c | 4 ++--
5
2 files changed, 4 insertions(+), 4 deletions(-)
3
src/nm-device-ethernet.c | 40 +++++++++++++++++++++++++++++++++++++---
4
src/nm-device-wifi.c | 34 +++++++++++++++++++++++++++++++++-
5
2 files changed, 70 insertions(+), 4 deletions(-)
7
Index: network-manager.07.ubuntu/src/nm-device-wifi.c
7
Index: network-manager.ubuntu.07/src/nm-device-wifi.c
8
8
===================================================================
9
--- network-manager.07.ubuntu.orig/src/nm-device-wifi.c
10
+++ network-manager.07.ubuntu/src/nm-device-wifi.c
11
@@ -2097,21 +2097,21 @@
9
--- network-manager.ubuntu.07.orig/src/nm-device-wifi.c
10
+++ network-manager.ubuntu.07/src/nm-device-wifi.c
12
guint pending_scan_id;
14
Supplicant supplicant;
16
guint32 failed_link_count;
17
guint periodic_source_id;
18
guint link_timeout_id;
22
/* Static options from driver */
25
gboolean has_scan_capa_ssid;
28
static guint32 nm_device_wifi_get_frequency (NMDeviceWifi *self);
30
@@ -2074,44 +2076,54 @@
35
struct state_cb_data {
40
+ GSList *source_link;
44
schedule_state_handler (NMDeviceWifi * self,
49
struct state_cb_data * cb_data;
50
+ NMDeviceWifiPrivate *priv;
52
g_return_val_if_fail (self != NULL, FALSE);
53
g_return_val_if_fail (handler != NULL, FALSE);
55
if (new_state == old_state)
58
+ priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
13
60
cb_data = g_slice_new0 (struct state_cb_data);
14
61
if (cb_data == NULL) {
15
62
nm_warning ("Not enough memory to process supplicant manager state"
32
83
supplicant_iface_state_cb_handler (gpointer user_data)
34
85
struct state_cb_data *cb_data = (struct state_cb_data *) user_data;
35
Index: network-manager.07.ubuntu/src/nm-device-ethernet.c
86
@@ -2138,16 +2150,19 @@
87
cancel_pending_scan (self);
88
request_wireless_scan (self);
89
} else if (new_state == NM_SUPPLICANT_INTERFACE_STATE_DOWN) {
90
cleanup_association_attempt (self, FALSE);
91
supplicant_interface_release (self);
92
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_UNAVAILABLE,
93
NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED);
96
+ g_source_remove (cb_data->source_id);
97
+ priv->timeouts = g_slist_remove_link (priv->timeouts, cb_data->source_link);
99
g_slice_free (struct state_cb_data, cb_data);
105
supplicant_iface_state_cb (NMSupplicantInterface * iface,
106
@@ -2210,16 +2225,19 @@
107
if (!priv->link_timeout_id) {
108
priv->link_timeout_id = g_timeout_add (priv->scanning ? 30000 : 15000,
109
link_timeout_cb, self);
115
+ g_source_remove (cb_data->source_id);
116
+ priv->timeouts = g_slist_remove_link (priv->timeouts, cb_data->source_link);
118
g_slice_free (struct state_cb_data, cb_data);
124
supplicant_iface_connection_state_cb (NMSupplicantInterface * iface,
126
@@ -2282,16 +2300,19 @@
128
if (priv->supplicant.iface) {
129
nm_device_state_changed (dev, NM_DEVICE_STATE_DISCONNECTED,
130
NM_DEVICE_STATE_REASON_NONE);
135
+ g_source_remove (cb_data->source_id);
136
+ priv->timeouts = g_slist_remove_link (priv->timeouts, cb_data->source_link);
138
g_slice_free (struct state_cb_data, cb_data);
143
supplicant_mgr_state_cb (NMSupplicantInterface * iface,
146
@@ -3071,16 +3092,21 @@
150
real_get_type_capabilities (NMDevice *dev)
152
return NM_DEVICE_WIFI_GET_PRIVATE (dev)->capabilities;
156
+remove_source_id_pointer (gpointer id, gpointer data)
158
+ g_source_remove (GPOINTER_TO_UINT(id));
162
nm_device_wifi_dispose (GObject *object)
164
NMDeviceWifi *self = NM_DEVICE_WIFI (object);
165
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
167
if (priv->dispose_has_run) {
168
@@ -3090,16 +3116,22 @@
170
priv->dispose_has_run = TRUE;
172
if (priv->periodic_source_id) {
173
g_source_remove (priv->periodic_source_id);
174
priv->periodic_source_id = 0;
177
+ if (priv->timeouts) {
178
+ g_slist_foreach(priv->timeouts, remove_source_id_pointer, NULL);
179
+ g_slist_free(priv->timeouts);
180
+ priv->timeouts = NULL;
183
cleanup_association_attempt (self, TRUE);
184
supplicant_interface_release (self);
186
if (priv->supplicant.mgr_state_id) {
187
g_signal_handler_disconnect (priv->supplicant.mgr, priv->supplicant.mgr_state_id);
188
priv->supplicant.mgr_state_id = 0;
191
Index: network-manager.ubuntu.07/src/nm-device-ethernet.c
36
192
===================================================================
37
--- network-manager.07.ubuntu.orig/src/nm-device-ethernet.c
38
+++ network-manager.07.ubuntu/src/nm-device-ethernet.c
193
--- network-manager.ubuntu.07.orig/src/nm-device-ethernet.c
194
+++ network-manager.ubuntu.07/src/nm-device-ethernet.c
197
char * carrier_file_path;
198
gulong link_connected_id;
199
gulong link_disconnected_id;
201
Supplicant supplicant;
202
guint link_timeout_id;
204
+ /* state handler timeout source ids */
208
NMPPPManager *ppp_manager;
209
NMIP4Config *pending_ip4_config;
210
} NMDeviceEthernetPrivate;
215
@@ -752,55 +755,69 @@
220
struct state_cb_data {
221
NMDeviceEthernet *self;
225
+ GSList *source_link;
229
schedule_state_handler (NMDeviceEthernet *self,
40
232
guint32 old_state)
42
234
struct state_cb_data * cb_data;
235
+ NMDeviceEthernetPrivate *priv;
44
237
if (new_state == old_state)
240
+ priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
47
242
cb_data = g_slice_new0 (struct state_cb_data);
48
- cb_data->self = self;
49
+ cb_data->self = g_object_ref(self);
243
cb_data->self = self;
50
244
cb_data->new_state = new_state;
51
245
cb_data->old_state = old_state;
53
247
- g_idle_add (handler, cb_data);
54
+ g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, handler, cb_data, g_object_unref);
248
+ cb_data->source_id = g_idle_add (handler, cb_data);
250
+ if(cb_data->source_id > 0) {
251
+ priv->timeouts = g_slist_append(priv->timeouts, GUINT_TO_POINTER(cb_data->source_id));
252
+ cb_data->source_link = priv->timeouts;
60
259
supplicant_mgr_state_cb_handler (gpointer user_data)
62
261
struct state_cb_data *info = (struct state_cb_data *) user_data;
262
NMDevice *device = NM_DEVICE (info->self);
263
+ NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (info->self);
265
/* If the supplicant went away, release the supplicant interface */
266
if (info->new_state == NM_SUPPLICANT_MANAGER_STATE_DOWN) {
267
supplicant_interface_clean (info->self);
269
if (nm_device_get_state (device) > NM_DEVICE_STATE_UNAVAILABLE) {
270
nm_device_state_changed (device, NM_DEVICE_STATE_UNAVAILABLE,
271
NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED);
275
+ g_source_remove (info->source_id);
276
+ priv->timeouts = g_slist_remove_link (priv->timeouts, info->source_link);
278
g_slice_free (struct state_cb_data, info);
284
supplicant_mgr_state_cb (NMSupplicantInterface * iface,
286
@@ -874,16 +891,19 @@
287
NMDeviceState state = nm_device_get_state (device);
289
supplicant_interface_clean (info->self);
291
if (nm_device_is_activating (device) || state == NM_DEVICE_STATE_ACTIVATED)
292
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED);
295
+ g_source_remove (info->source_id);
296
+ priv->timeouts = g_slist_remove_link (priv->timeouts, info->source_link);
298
g_slice_free (struct state_cb_data, info);
304
supplicant_iface_state_cb (NMSupplicantInterface * iface,
306
@@ -902,39 +922,41 @@
311
supplicant_iface_connection_state_cb_handler (gpointer user_data)
313
struct state_cb_data *info = (struct state_cb_data *) user_data;
314
NMDevice *dev = NM_DEVICE (info->self);
315
+ NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (info->self);
317
if (info->new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_COMPLETED) {
318
remove_supplicant_interface_connection_error_handler (info->self);
319
remove_supplicant_timeouts (info->self);
321
/* If this is the initial association during device activation,
322
* schedule the next activation stage.
324
if (nm_device_get_state (dev) == NM_DEVICE_STATE_CONFIG) {
325
nm_info ("Activation (%s/wired) Stage 2 of 5 (Device Configure) successful.",
326
nm_device_get_iface (dev));
327
nm_device_activate_schedule_stage3_ip_config_start (dev);
329
} else if (info->new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_DISCONNECTED) {
330
if (nm_device_get_state (dev) == NM_DEVICE_STATE_ACTIVATED || nm_device_is_activating (dev)) {
331
- NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (info->self);
333
/* Start the link timeout so we allow some time for reauthentication */
334
if (!priv->link_timeout_id)
335
priv->link_timeout_id = g_timeout_add (15000, link_timeout_cb, dev);
339
+ g_source_remove (info->source_id);
340
+ priv->timeouts = g_slist_remove_link (priv->timeouts, info->source_link);
342
g_slice_free (struct state_cb_data, info);
348
supplicant_iface_connection_state_cb (NMSupplicantInterface * iface,
350
@@ -1337,28 +1359,40 @@
353
// FIXME: check bitrate against device capabilities
359
+remove_source_id_pointer (gpointer id, gpointer data)
361
+ g_source_remove (GPOINTER_TO_UINT(id));
365
nm_device_ethernet_dispose (GObject *object)
367
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object);
368
NMNetlinkMonitor *monitor;
370
if (priv->dispose_has_run) {
371
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object);
375
priv->dispose_has_run = TRUE;
377
+ if (priv->timeouts) {
378
+ g_slist_foreach(priv->timeouts, remove_source_id_pointer, NULL);
379
+ g_slist_free(priv->timeouts);
380
+ priv->timeouts = NULL;
383
monitor = nm_netlink_monitor_get ();
384
if (priv->link_connected_id) {
385
g_signal_handler_disconnect (monitor, priv->link_connected_id);
386
priv->link_connected_id = 0;
388
if (priv->link_disconnected_id) {
389
g_signal_handler_disconnect (monitor, priv->link_disconnected_id);
390
priv->link_disconnected_id = 0;