Hi,

2014/1/13 Tomasz Bursztyka <[email protected]>

> Hi,
>
>
>  Here session has known which service(session->service) it will connect.
>> I think we can modify "__connman_service_auto_connect()", and add a
>> parameter:
>> __connman_service_auto_connect(struct connman_service *service);
>>
>
> No, first here the session is disconnecting and secondary
> __connman_service_auto_connect() is tightly following the service list
> order and other factors: it's meant to be automatic.
>

Thanks, yes, here session is disconnecting.

In fact, my meaning, when session module call the method
__connman_service_auto_connect,
session knows which service it will connect or disconnect, if ConnMan add a
parameter
"struct connman_service *service"  to __connman_service_auto_connect,
and then ConnMan don't need to lookup the service from service_list again.

I think it is possible to optimize the algorithm, kindly give me your
advice, please.

Example:
void __connman_service_auto_connect(*struct connman_service *service*)
{
    DBG("");

    if (autoconnect_timeout != 0)
        return;

    autoconnect_timeout = g_timeout_add_seconds(0, run_auto_connect,
*service*);
}

static gboolean run_auto_connect(*gpointer data*)
{
    bool autoconnecting = false;
    GList *preferred_tech;

    autoconnect_timeout = 0;

    DBG("");


*    struct connman_service *service = data;*



*    if (service) {        ......    }*

    preferred_tech = preferred_tech_list_get();
    if (preferred_tech) {
        autoconnecting = auto_connect_service(preferred_tech, true);
        g_list_free(preferred_tech);
    }

    if (!autoconnecting || __connman_session_running())
        auto_connect_service(service_list, false);

    if (connman_setting_get_bool("SessionAutoConnectMode"))
        auto_disconnect_service();

    return FALSE;
}


Thanks a lot.
Chengyi

>
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to