Re: one connection at a time



On Fri, 2008-06-13 at 00:13 +0530, Bhupesh Rawal wrote:
> Hi,
> 
> I am using Network-Manager-0.7 and it supports two or more connections
> present at same time. For example both WWAN and WLAN are present.
> Please suggest where i can put checks in code to make only one
> connection at a time. If i make any connection then other should get
> down automatically. Any help would be appreciated.

src/nm-manager.c::internal_activate_device() - right before the
nm_act_request_new() call, you'll want to search the manager's device
list and for any device in the list:

for (each device in priv->devices) {
    NMActRequest *req;
    GError *my_error = NULL;

    req = nm_device_get_act_request (device);
    if (req) {
        if (!nm_manager_deactivate_connection(manager, nm_act_request_get_active_connection_path (req), &my_error)) {
            /* deactivation failed for some reason; just ignore */
            g_error_free (my_error);
        }
    }
}

Note that this will ignore active VPN connections, which is probably
what you want.

Dan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]