Changeset 2538

Show
Ignore:
Timestamp:
08/01/07 11:13:37
Author:
pvanhoof
Message:

Cancel warning and hang fix

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r2537 r2538  
     12007-08-01  Philip Van Hoof  <pvanhoof@gnome.org> 
     2 
     3        * Reconnect hang fix 
     4        * Invalid cancelled warning fix 
     5 
    162007-07-31  Philip Van Hoof  <pvanhoof@gnome.org> 
    27 
  • trunk/libtinymail-camel/tny-camel-account.c

    r2536 r2538  
    6363 
    6464guint tny_camel_account_signals [TNY_CAMEL_ACCOUNT_LAST_SIGNAL]; 
     65 
     66 
     67typedef struct { 
     68        TnyCamelAccount *self; 
     69} ReconInfo; 
     70 
     71static gpointer 
     72reconnect_thread (gpointer user_data) 
     73{ 
     74        ReconInfo *info = (ReconInfo *) user_data; 
     75        TnyCamelAccount *self = (TnyCamelAccount *) info->self; 
     76        TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     77        CamelException ex = CAMEL_EXCEPTION_INITIALISER; 
     78 
     79        apriv->service->reconnecting = TRUE; 
     80        if (apriv->service->reconnecter) 
     81                apriv->service->reconnecter (apriv->service, FALSE, apriv->service->data); 
     82        camel_service_disconnect (apriv->service, FALSE, &ex); 
     83        if (camel_exception_is_set (&ex)) 
     84                camel_exception_clear (&ex); 
     85        camel_service_connect (apriv->service, &ex); 
     86        if (apriv->service->reconnection) 
     87        { 
     88                if (!camel_exception_is_set (&ex)) 
     89                        apriv->service->reconnection (apriv->service, TRUE, apriv->service->data); 
     90                else 
     91                        apriv->service->reconnection (apriv->service, FALSE, apriv->service->data); 
     92        } 
     93        apriv->service->reconnecting = FALSE; 
     94 
     95        g_object_unref (info->self); 
     96        g_slice_free (ReconInfo, info); 
     97        return NULL; 
     98} 
    6599 
    66100void 
     
    139173                        goto fail; 
    140174 
    141                 apriv->service->reconnecting = TRUE; 
    142  
    143                 if (apriv->service->reconnecter) 
    144                         apriv->service->reconnecter (apriv->service, FALSE, apriv->service->data); 
    145  
    146                 camel_service_disconnect (apriv->service, FALSE, &ex); 
    147                 if (camel_exception_is_set (&ex)) 
    148                         camel_exception_clear (&ex); 
    149  
    150                 camel_service_connect (apriv->service, &ex); 
    151                 if (apriv->service->reconnection) 
     175                if (TNY_IS_STORE_ACCOUNT (self)) 
    152176                { 
    153                         if (!camel_exception_is_set (&ex)) 
    154                                 apriv->service->reconnection (apriv->service, TRUE, apriv->service->data); 
    155                         else 
    156                                 apriv->service->reconnection (apriv->service, FALSE, apriv->service->data); 
     177                        TnyCamelStoreAccountPriv *aspriv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self); 
     178                        ReconInfo *info = g_slice_new0 (ReconInfo); 
     179                        info->self = self; 
     180 
     181                        /* thread reference */ 
     182                        g_object_ref (info->self); 
     183 
     184                        _tny_camel_queue_launch (aspriv->queue,  
     185                                reconnect_thread, info); 
    157186                } 
    158  
    159                 apriv->service->reconnecting = FALSE; 
    160                  
    161187        } 
    162188 
     
    500526        g_mutex_lock (priv->cancel_lock); 
    501527 
     528/* 
    502529        if (cancel) 
    503530        { 
    504                 /* I know this isn't polite. But it works ;-) */ 
    505                 /* camel_operation_cancel (NULL); */ 
     531                / I know this isn't polite. But it works ;-) / 
     532                / camel_operation_cancel (NULL); / 
     533 
    506534                thread = g_thread_create (camel_cancel_hack_thread, NULL, TRUE, &err); 
    507535                if (err == NULL) 
     
    513541                if (priv->cancel) 
    514542                { 
    515                         /*while (!camel_operation_cancel_check (priv->cancel))  
     543                        /while (!camel_operation_cancel_check (priv->cancel))  
    516544                        {  
    517545                                g_warning (_("Cancellation failed, retrying\n")); 
    518546                                thread = g_thread_create (camel_cancel_hack_thread, NULL, TRUE, NULL); 
    519547                                g_thread_join (thread); 
    520                         }*
     548                        }
    521549                        tny_camel_account_stop_camel_operation_priv (priv); 
    522550                } 
    523551 
     552 
    524553                camel_operation_uncancel (NULL); 
    525554        } 
     555*/ 
    526556 
    527557        while (priv->inuse_spin);  
     
    10381068        } 
    10391069 
    1040         camel_operation_uncancel (NULL); 
     1070        camel_operation_uncancel (NULL);  
    10411071 
    10421072        g_mutex_unlock (priv->cancel_lock);