OLD | NEW |
1 /* | 1 /* |
2 * | 2 * |
3 * Connection Manager | 3 * Connection Manager |
4 * | 4 * |
5 * Copyright (C) 2007-2009 Intel Corporation. All rights reserved. | 5 * Copyright (C) 2007-2009 Intel Corporation. All rights reserved. |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License version 2 as | 8 * it under the terms of the GNU General Public License version 2 as |
9 * published by the Free Software Foundation. | 9 * published by the Free Software Foundation. |
10 * | 10 * |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 * Mark network disconnected and update associated service and | 887 * Mark network disconnected and update associated service and |
888 * device to reflect network state change. | 888 * device to reflect network state change. |
889 */ | 889 */ |
890 int connman_network_set_disconnected(struct connman_network *network) | 890 int connman_network_set_disconnected(struct connman_network *network) |
891 { | 891 { |
892 int err; | 892 int err; |
893 | 893 |
894 _DBG_NETWORK("network %p state %s", network, | 894 _DBG_NETWORK("network %p state %s", network, |
895 state_names[network->state]); | 895 state_names[network->state]); |
896 | 896 |
| 897 /* NB: hold a ref as the network may be reclaimed */ |
| 898 (void) connman_network_ref(network); |
| 899 |
897 err = connman_network_set_disconnected_only(network); | 900 err = connman_network_set_disconnected_only(network); |
898 » if (err != 0) | 901 » if (err == 0 && network->registered == TRUE) |
899 » » return err; | 902 » » set_connected(network); |
900 | 903 |
901 » if (network->registered == FALSE) { | 904 » connman_network_unref(network); |
902 » » /* NB: should not happen */ | 905 |
903 » » _DBG_NETWORK("not registered; defer"); | 906 » return err; |
904 » » g_idle_add(set_connected, network); | |
905 » } else { | |
906 » » set_connected(network); | |
907 » } | |
908 » return 0; | |
909 } | 907 } |
910 | 908 |
911 /** | 909 /** |
912 * __connman_network_disconnect: | 910 * __connman_network_disconnect: |
913 * @network: network structure | 911 * @network: network structure |
914 * | 912 * |
915 * Disconnect network. | 913 * Disconnect network. |
916 */ | 914 */ |
917 int __connman_network_disconnect(struct connman_network *network) | 915 int __connman_network_disconnect(struct connman_network *network) |
918 { | 916 { |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 } | 1619 } |
1622 | 1620 |
1623 void __connman_network_cleanup(void) | 1621 void __connman_network_cleanup(void) |
1624 { | 1622 { |
1625 _DBG_NETWORK(""); | 1623 _DBG_NETWORK(""); |
1626 | 1624 |
1627 connman_driver_unregister(&network_driver); | 1625 connman_driver_unregister(&network_driver); |
1628 | 1626 |
1629 dbus_connection_unref(connection); | 1627 dbus_connection_unref(connection); |
1630 } | 1628 } |
OLD | NEW |