Changeset 3423

Show
Ignore:
Timestamp:
02/20/08 17:48:24
Author:
pvanhoof
Message:

2008-02-20 Philip Van Hoof <pvanhoof@gnome.org>

        • Improvement for cancel's their reconnection
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3416 r3423  
     12008-02-20  Philip Van Hoof <pvanhoof@gnome.org> 
     2 
     3        * Improvement for cancel's their reconnection 
     4 
    152008-02-18  Philip Van Hoof <pvanhoof@gnome.org> 
    26 
  • trunk/libtinymail-camel/camel-lite/camel/camel-operation.c

    r3256 r3423  
    2525#endif 
    2626 
    27 #include <pthread.h> 
    28 #include <stdio.h> 
    29 #include <unistd.h> 
    30 #include <sys/time.h> 
    31  
    32 #ifdef HAVE_NSS 
    33 #include <nspr.h> 
    34 #endif 
    35  
    36 #include <glib.h> 
    37  
    38 #include <libedataserver/e-msgport.h> 
    3927 
    4028#include "camel-operation.h" 
     
    5139}; 
    5240 
    53 struct _CamelOperation { 
    54         struct _CamelOperation *next; 
    55         struct _CamelOperation *prev; 
    56  
    57         pthread_t id;           /* id of running thread */ 
    58         guint32 flags;          /* cancelled ? */ 
    59         int blocked;            /* cancellation blocked depth */ 
    60         int refcount; 
    61  
    62         CamelOperationStatusFunc status; 
    63         void *status_data; 
    64         unsigned int status_update; 
    65  
    66         /* stack of status messages (struct _status_stack *) */ 
    67         GSList *status_stack; 
    68         struct _status_stack *lastreport; 
    69  
    70         EMsgPort *cancel_port; 
    71         int cancel_fd; 
    72 #ifdef HAVE_NSS 
    73         PRFileDesc *cancel_prfd; 
     41 
     42#ifndef CAMEL_OPERATION_CANCELLED 
     43#define CAMEL_OPERATION_CANCELLED (1<<0) 
    7444#endif 
    75 }; 
    76  
    77 #define CAMEL_OPERATION_CANCELLED (1<<0) 
    7845#define CAMEL_OPERATION_TRANSIENT (1<<1) 
    7946 
  • trunk/libtinymail-camel/camel-lite/camel/camel-operation.h

    r2950 r3423  
    2323#define CAMEL_OPERATION_H 1 
    2424 
     25#include <pthread.h> 
     26#include <stdio.h> 
     27#include <unistd.h> 
     28#include <sys/time.h> 
     29 
     30 
     31#include <glib.h> 
     32 
     33#include <libedataserver/e-msgport.h> 
     34 
     35#ifdef HAVE_NSS 
     36#include <nspr.h> 
     37#endif 
     38 
    2539G_BEGIN_DECLS 
    2640 
     
    3044 
    3145typedef void (*CamelOperationStatusFunc)(struct _CamelOperation *op, const char *what, int sofar, int oftotal, void *data); 
     46 
     47#ifndef CAMEL_OPERATION_CANCELLED 
     48#define CAMEL_OPERATION_CANCELLED (1<<0) 
     49#endif 
     50 
     51 
     52struct _CamelOperation { 
     53        struct _CamelOperation *next; 
     54        struct _CamelOperation *prev; 
     55 
     56        pthread_t id;           /* id of running thread */ 
     57        guint32 flags;          /* cancelled ? */ 
     58        int blocked;            /* cancellation blocked depth */ 
     59        int refcount; 
     60 
     61        CamelOperationStatusFunc status; 
     62        void *status_data; 
     63        unsigned int status_update; 
     64 
     65        /* stack of status messages (struct _status_stack *) */ 
     66        GSList *status_stack; 
     67        struct _status_stack *lastreport; 
     68 
     69        EMsgPort *cancel_port; 
     70        int cancel_fd; 
     71#ifdef HAVE_NSS 
     72        PRFileDesc *cancel_prfd; 
     73#endif 
     74}; 
    3275 
    3376typedef enum _camel_operation_status_t { 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c

    r3280 r3423  
    370370 
    371371 
    372                 camel_imap_recon (store, &mex); 
     372                camel_imap_recon (store, &mex, FALSE); 
    373373                imap_debug ("Recon in start: %s\n", camel_exception_get_description (&mex)); 
    374374 
     
    412412                        camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, 
    413413                                             _("Operation cancelled")); 
    414                         camel_imap_recon (store, &mex); 
     414                        camel_imap_recon (store, &mex, TRUE); 
    415415                        imap_debug ("Recon in cont: %s\n", camel_exception_get_description (&mex)); 
    416416                        CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); 
     
    711711                                        camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, 
    712712                                                             _("Operation cancelled")); 
    713                                         camel_imap_recon (store, &mex); 
     713                                        camel_imap_recon (store, &mex, TRUE); 
    714714                                        imap_debug ("Recon in untagged: %s\n", camel_exception_get_description (&mex)); 
    715715                                        camel_exception_clear (&mex); 
     
    731731                                camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, 
    732732                                                     _("Operation cancelled")); 
    733                                 camel_imap_recon (store, &mex); 
     733                                camel_imap_recon (store, &mex, TRUE); 
    734734                                imap_debug ("Recon in untagged idle: %s\n", camel_exception_get_description (&mex)); 
    735735                                camel_exception_clear (&mex); 
     
    876876                                        camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, 
    877877                                                             _("Operation cancelled")); 
    878                                         camel_imap_recon (store, &mex); 
     878                                        camel_imap_recon (store, &mex, TRUE); 
    879879                                        imap_debug ("Recon in untagged: %s\n", camel_exception_get_description (&mex)); 
    880880                                        camel_exception_clear (&mex); 
     
    896896                                camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, 
    897897                                                     _("Operation cancelled")); 
    898                                 camel_imap_recon (store, &mex); 
     898                                camel_imap_recon (store, &mex, TRUE); 
    899899                                imap_debug ("Recon in untagged idle: %s\n", camel_exception_get_description (&mex)); 
    900900                                camel_exception_clear (&mex); 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c

    r3398 r3423  
    160160 
    161161void 
    162 camel_imap_recon (CamelImapStore *store, CamelException *mex
     162camel_imap_recon (CamelImapStore *store, CamelException *mex, gboolean was_cancel
    163163{ 
    164164        if (store->not_recon) { 
    165165                camel_exception_set (mex, CAMEL_EXCEPTION_SERVICE_LOST_CONNECTION, 
    166166                        _("Connection lost during operation")); 
    167                 return; 
    168167        } else { 
    169168                CamelService *service = CAMEL_SERVICE (store); 
     
    195194 
    196195                service->reconnecting = FALSE; 
     196        } 
     197 
     198        if (was_cancel) { 
     199                CamelOperation *cc = camel_operation_registered (); 
     200                errno = EINTR; 
     201                cc->flags |= CAMEL_OPERATION_CANCELLED; 
     202                camel_operation_unref (cc); 
    197203        } 
    198204} 
     
    42124218                        CamelException mex = CAMEL_EXCEPTION_INITIALISER; 
    42134219                        camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled")); 
    4214                         camel_imap_recon (store, &mex); 
     4220                        camel_imap_recon (store, &mex, TRUE); 
    42154221                        imap_debug ("Recon: %s\n", camel_exception_get_description (&mex)); 
    42164222                        camel_exception_clear (&mex); 
     
    42884294                        CamelException mex = CAMEL_EXCEPTION_INITIALISER; 
    42894295                        camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled")); 
    4290                         camel_imap_recon (store, &mex); 
     4296                        camel_imap_recon (store, &mex, TRUE); 
    42914297                        imap_debug ("Recon in nl: %s\n", camel_exception_get_description (&mex)); 
    42924298                        camel_exception_clear (&mex); 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.h

    r3235 r3423  
    198198void camel_imap_store_stop_idle (CamelImapStore *store); 
    199199void camel_imap_store_start_idle (CamelImapStore *store); 
    200 void camel_imap_recon (CamelImapStore *store, CamelException *mex); 
     200void camel_imap_recon (CamelImapStore *store, CamelException *mex, gboolean was_cancel); 
    201201 
    202202G_END_DECLS