Update handling of shutdown procedure
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 9 Jan 2008 15:47:18 +0000 (16:47 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 9 Jan 2008 15:47:18 +0000 (16:47 +0100)
src/iface.c

index b440d5288aec434134cedc34de3e2d377d5008d3..a5327f51baa2fc8966491a6d1c5568f39af00a65 100644 (file)
@@ -101,6 +101,10 @@ int connman_iface_update(struct connman_iface *iface,
        const char *str = NULL;
 
        switch (state) {
+       case CONNMAN_IFACE_STATE_OFF:
+               str = "off";
+               break;
+
        case CONNMAN_IFACE_STATE_ENABLED:
                str = "enabled";
                if (iface->type == CONNMAN_IFACE_TYPE_80211) {
@@ -119,6 +123,10 @@ int connman_iface_update(struct connman_iface *iface,
                break;
 
        case CONNMAN_IFACE_STATE_SHUTDOWN:
+               str = "shutdown";
+               __connman_dhcp_release(iface);
+               if (iface->driver->shutdown)
+                       iface->driver->shutdown(iface);
                break;
 
        default:
@@ -505,10 +513,9 @@ static DBusMessage *set_policy(DBusConnection *conn,
                if (new_policy == CONNMAN_IFACE_POLICY_AUTO) {
                        if (iface->driver->activate)
                                iface->driver->activate(iface);
-               } else {
-                       if (iface->driver->shutdown)
-                               iface->driver->shutdown(iface);
-               }
+               } else
+                       connman_iface_update(iface,
+                                       CONNMAN_IFACE_STATE_SHUTDOWN);
 
                g_dbus_emit_signal(conn, path, CONNMAN_IFACE_INTERFACE,
                                "PolicyChanged", DBUS_TYPE_STRING, &policy,