Re: Asynchronously connecting



Philip Van Hoof wrote:
> On Mon, 2007-01-29 at 01:34 +0100, Philip Van Hoof wrote:
>> I already found some defects, so it's possible that this will be
>> reverted.
> 
> 
> The async connecting should now also report errors in the alert
> function.

I've been testing it a little bit and I found a problem. The error
reporting does not work in all the situations. If you want to check it,
just comment the second call to tny_account_store_get_accounts in the
demo UI (and the gtk_combo_box_set_model). Then open the demoUI, and
click in the "Go online" button, then when prompted for a password,
press Cancel and then the alert dialog won't appear (it did with the
code uncommented).

I studied it for some time but I couldn't found the error. The point is
that in the first call to tny_account_store_get_accounts, the
camel-session is not able to found the provider's services

<code at camel-session.c get_service>
/* Now look up the service in the provider's cache */
service = camel_object_bag_reserve(provider->service_cache[type], url);
</code>

so it constructs them all. The CamelSession was previously set as online
so the disco stores are created with status CAMEL_DISCO_STORE_ONLINE.
Then when the TnyCamelAccount calls camel_disco_store_set_status this
function will exit without doing anything because the status is online.
But it won't return any error so the function
foreach_account_set_connectivity won't call the alert message.

Well, it's not easy to understand my words, it's better just to debug it
. Maybe some lock is needed.

Br

PS: find attached a patch that initializes a field. Without it a SIGSEV
is issued sometimes. And there was a variable that was incorrectly
initialized IMO.

PS2: sorry for this ultra-dense-super-technical email :)
Index: tny-session-camel.c
===================================================================
--- tny-session-camel.c	(revision 1534)
+++ tny-session-camel.c	(working copy)
@@ -348,6 +348,7 @@
 
 	priv->conlock = g_mutex_new ();
 	priv->conthread = NULL;
+	priv->current_accounts = NULL;
 	priv->prev_constat = FALSE;
 	priv->device = NULL;
 	priv->camel_dir = NULL;
@@ -399,7 +400,6 @@
 foreach_account_set_connectivity (gpointer data, gpointer udata)
 {
 	BackgroundConnectInfo *info = udata;
-	gboolean online = (gboolean)udata;
 	CamelSession *session = info->user_data;
 
 	if (data && TNY_IS_CAMEL_ACCOUNT (data))
@@ -409,7 +409,7 @@
 		_tny_camel_account_try_connect (TNY_CAMEL_ACCOUNT (data), &err);
 
 		if (err == NULL)
-			tny_camel_account_set_online_status (TNY_CAMEL_ACCOUNT (data), !online, &err);
+			tny_camel_account_set_online_status (TNY_CAMEL_ACCOUNT (data), !info->online, &err);
 
 		if (err != NULL) 
 		{


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