2004-10-15 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerAPList.c
		- (nm_ap_list_update_network): Disown AP after the list takes ownership

	* src/NetworkManagerDbus.c
		- (nm_dbus_nm_set_active_device): Simplify the device setting logic

	* src/NetworkManagerDevice.c
		- Disown APs after the device's AP list takes ownership


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@246 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2004-10-15 20:05:56 +00:00
parent 6e7f8e9989
commit a0a36acfd0
4 changed files with 39 additions and 18 deletions

View file

@ -1,3 +1,14 @@
2004-10-15 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerAPList.c
- (nm_ap_list_update_network): Disown AP after the list takes ownership
* src/NetworkManagerDbus.c
- (nm_dbus_nm_set_active_device): Simplify the device setting logic
* src/NetworkManagerDevice.c
- Disown APs after the device's AP list takes ownership
2004-10-15 Dan Williams <dcbw@redhat.com>
* panel-applet/NMWirelessApplet.c

View file

@ -287,9 +287,14 @@ void nm_ap_list_update_network (NMAccessPointList *list, const char *network, NM
if (timestamp != NULL)
{
gboolean new = FALSE;
/* Find access point in list, if not found create a new AP and add it to the list */
if (!(ap = nm_ap_list_get_ap_by_essid (list, network)))
nm_ap_list_append_ap (list, (ap = nm_ap_new ()));
{
ap = nm_ap_new ();
new = TRUE;
}
nm_ap_set_essid (ap, essid);
nm_ap_set_timestamp (ap, timestamp);
@ -298,6 +303,12 @@ void nm_ap_list_update_network (NMAccessPointList *list, const char *network, NM
nm_ap_set_enc_key_source (ap, key, enc_method);
else
nm_ap_set_enc_key_source (ap, NULL, NM_AP_ENC_METHOD_UNKNOWN);
if (new)
{
nm_ap_list_append_ap (list, ap);
nm_ap_unref (ap);
}
}
g_free (timestamp);

View file

@ -279,32 +279,29 @@ static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DB
if (!(reply_message = dbus_message_new_method_return (message)))
goto out;
/* Notify the state modification handler that we'd like to lock on a specific device */
if (nm_try_acquire_mutex (data->user_device_mutex, __FUNCTION__))
/* If the user specificed a wireless network too, force that as well */
if (nm_device_is_wireless (dev) && !nm_device_find_and_use_essid (dev, network))
{
gboolean success = TRUE;
/* If the user specificed a wireless network too, force that as well */
if (nm_device_is_wireless (dev) && !nm_device_find_and_use_essid (dev, network))
{
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NetworkNotFound",
"The requested wireless network is not in range.");
success = FALSE;
}
if (success)
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NetworkNotFound",
"The requested wireless network is not in range.");
}
else
{
if (nm_try_acquire_mutex (data->user_device_mutex, __FUNCTION__))
{
if (data->user_device)
nm_device_unref (data->user_device);
data->user_device = dev;
nm_device_ref (data->user_device);
nm_unlock_mutex (data->user_device_mutex, __FUNCTION__);
}
nm_unlock_mutex (data->user_device_mutex, __FUNCTION__);
if (success)
nm_data_mark_state_changed (data);
}
/* Have to mark our state changed since we blew away our connection trying out
* the user-requested network.
*/
nm_data_mark_state_changed (data);
out:
dbus_free (network);
nm_device_unref (dev);

View file

@ -2132,6 +2132,7 @@ gboolean nm_device_find_and_use_essid (NMDevice *dev, const char *essid)
nm_ap_set_artificial (ap, TRUE);
nm_ap_set_address (ap, &ap_addr);
nm_ap_list_append_ap (nm_device_ap_list_get (dev), ap);
nm_ap_unref (ap);
}
/* Now that this AP has an essid, copy over encryption keys and whatnot */
@ -2260,6 +2261,7 @@ static void nm_device_do_normal_scan (NMDevice *dev)
/* Add the AP to the device's AP list */
nm_ap_list_append_ap (dev->options.wireless.cached_ap_list1, nm_ap);
nm_ap_unref (nm_ap);
}
tmp_ap = tmp_ap->next;
}