Changeset 3119
- Timestamp:
- 12/14/07 00:42:03
- Files:
-
- trunk/ChangeLog (modified) (2 diffs)
- trunk/libtinymail-camel/Makefile.am (modified) (2 diffs)
- trunk/libtinymail-camel/camel-lite/camel/camel-folder-summary.c (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/camel-net-utils.c (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/camel-net-utils.h (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/camel-store-summary.c (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/camel-text-index.c (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c (modified) (2 diffs)
- trunk/libtinymail-camel/camel-lite/camel/providers/local/camel-local-store.c (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/providers/local/camel-mbox-folder.c (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-account-priv.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-account.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-camel-default-connection-strategy.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-camel-folder.c (modified) (7 diffs)
- trunk/libtinymail-camel/tny-camel-recover-connection-strategy.c (added)
- trunk/libtinymail-camel/tny-camel-recover-connection-strategy.h (added)
- trunk/libtinymail-camel/tny-camel-store-account.c (modified) (3 diffs)
- trunk/libtinymail/tny-connection-strategy.c (modified) (1 diff)
- trunk/libtinymail/tny-connection-strategy.h (modified) (2 diffs)
- trunk/libtinymail/tny-mime-part.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r3118 r3119 4 4 changes (for example sheduling a reconnect or asking the user what to 5 5 do about the event of a lost connection) 6 * Added two connection strategies. One that retries every five seconds 7 to reconnect, and recovers the state (the selected folder) 6 8 7 9 2007-12-13 Alberto Garcia Gonzalez <agarcia@igalia.com> … … 2234 2236 2007-05-26 Philip Van Hoof <pvanhoof@gnome.org> 2235 2237 2236 * Experimental connection recovery for IMAP2238 * Experimental connection camel_recovery for IMAP 2237 2239 * Letting IDLE/PushE-mail support code cope with connection failures 2238 2240 trunk/libtinymail-camel/Makefile.am
r3118 r3119 39 39 tny-camel-bs-mime-part.h \ 40 40 tny-camel-bs-msg-receive-strategy.h \ 41 tny-camel-default-connection-strategy.h 41 tny-camel-default-connection-strategy.h \ 42 tny-camel-recover-connection-strategy.h 42 43 43 44 libtinymail_camel_priv_headers = \ … … 95 96 tny-camel-bs-msg-receive-strategy.c \ 96 97 tny-camel-bs-msg-header.c \ 97 tny-camel-default-connection-strategy.c 98 tny-camel-default-connection-strategy.c \ 99 tny-camel-recover-connection-strategy.c 98 100 99 101 libtinymail_camel_1_0_la_LIBADD = \ trunk/libtinymail-camel/camel-lite/camel/camel-folder-summary.c
r3114 r3119 2274 2274 { 2275 2275 2276 /* We are not reloading, so searching for recoverable2276 /* We are not reloading, so searching for camel_recoverable 2277 2277 * CamelMessageInfo struct instances is avoidable */ 2278 2278 mi = (CamelMessageInfoBase *) camel_message_info_new (s); trunk/libtinymail-camel/camel-lite/camel/camel-net-utils.c
r2950 r3119 193 193 break; 194 194 default: 195 return NO_ RECOVERY;195 return NO_CAMEL_RECOVERY; 196 196 break; 197 197 } trunk/libtinymail-camel/camel-lite/camel/camel-net-utils.h
r2950 r3119 68 68 #define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ 69 69 #define EAI_AGAIN -3 /* Temporary failure in name resolution. */ 70 #define EAI_FAIL -4 /* Non- recoverable failure in name res. */70 #define EAI_FAIL -4 /* Non-camel_recoverable failure in name res. */ 71 71 #define EAI_NODATA -5 /* No address associated with NAME. */ 72 72 #define EAI_FAMILY -6 /* `ai_family' not supported. */ trunk/libtinymail-camel/camel-lite/camel/camel-store-summary.c
r2950 r3119 941 941 942 942 /* Ok, brown paper bag bug - prior to version 2 of the file, flags are 943 stored using the bit number, not the bit. Try to recover as best we can */943 stored using the bit number, not the bit. Try to camel_recover as best we can */ 944 944 if (s->version < CAMEL_STORE_SUMMARY_VERSION_2) { 945 945 guint32 flags = 0; trunk/libtinymail-camel/camel-lite/camel/camel-text-index.c
r3068 r3119 354 354 } 355 355 356 /* Attempt to recover index space by compressing the indices */356 /* Attempt to camel_recover index space by compressing the indices */ 357 357 static int 358 358 text_index_compress_nosync(CamelIndex *idx) trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c
r3112 r3119 12 12 * 13 13 * It has support for CONDSTORE, BINARY and IMAP IDLE. This implementation will 14 * write received information to disk as soon as possible, and will try recover14 * write received information to disk as soon as possible, and will try camel_recover 15 15 * the state using this information as much as possible. 16 16 * trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c
r3091 r3119 836 836 if (store->ostream && CAMEL_IS_STREAM (store->ostream)) 837 837 { 838 /* This is a recoverable situation. It's strange though */838 /* This is a camel_recoverable situation. It's strange though */ 839 839 store->istream = camel_stream_buffer_new (store->ostream, CAMEL_STREAM_BUFFER_READ); 840 840 } else { … … 843 843 camel_service_disconnect (CAMEL_SERVICE (store), FALSE, &ex); 844 844 camel_exception_clear (&ex); 845 g_warning ("Something terrible happened with your connection.\nTrying to recover. (%s)\n",845 g_warning ("Something terrible happened with your connection.\nTrying to camel_recover. (%s)\n", 846 846 g_strerror (errno)); 847 847 camel_service_connect (CAMEL_SERVICE (store), &ex); 848 848 if (camel_exception_is_set (&ex)) 849 g_warning ("Connection recovery failed: %s",849 g_warning ("Connection camel_recovery failed: %s", 850 850 camel_exception_get_description (&ex)); 851 851 return FALSE; trunk/libtinymail-camel/camel-lite/camel/providers/local/camel-local-store.c
r2967 r3119 435 435 return; 436 436 437 /* The (f)utility of this recovery effort is quesitonable */437 /* The (f)utility of this camel_recovery effort is quesitonable */ 438 438 439 439 xrename(new, old, path, ".cmeta", TRUE, ex); trunk/libtinymail-camel/camel-lite/camel/providers/local/camel-mbox-folder.c
r2950 r3119 404 404 camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID, 405 405 _("Cannot get message: %s from folder %s\n %s"), uid, lf->folder_path, 406 _("The folder appears to be ir recoverably corrupted."));406 _("The folder appears to be ircamel_recoverably corrupted.")); 407 407 goto fail; 408 408 } trunk/libtinymail-camel/tny-camel-account-priv.h
r3118 r3119 73 73 GList *chooks; 74 74 TnyConnectionStatus status; 75 gboolean is_connecting, is_ready ;75 gboolean is_connecting, is_ready, retry_connect; 76 76 gchar *delete_this; 77 77 TnyCamelQueue *queue; trunk/libtinymail-camel/tny-camel-account.c
r3118 r3119 1370 1370 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 1371 1371 1372 priv->retry_connect = FALSE; 1372 1373 priv->con_strat = tny_camel_default_connection_strategy_new (); 1373 1374 priv->queue = _tny_camel_queue_new (self); … … 1700 1701 1701 1702 if (TNY_IS_CAMEL_STORE_ACCOUNT (self)) { 1703 priv->retry_connect = TRUE; 1702 1704 if (online) 1703 1705 camel_session_set_online ((CamelSession *) session, TRUE); trunk/libtinymail-camel/tny-camel-default-connection-strategy.c
r3118 r3119 8 8 9 9 static GObjectClass *parent_class = NULL; 10 11 static void 12 tny_camel_default_connection_strategy_set_current (TnyConnectionStrategy *self, TnyAccount *account, TnyFolder *folder) 13 { 14 return; 15 } 10 16 11 17 static void … … 44 50 klass->on_connection_broken_func = tny_camel_default_connection_strategy_on_connection_broken; 45 51 klass->on_disconnect_func = tny_camel_default_connection_strategy_on_disconnect; 52 klass->set_current_func = tny_camel_default_connection_strategy_set_current; 46 53 } 47 54 trunk/libtinymail-camel/tny-camel-folder.c
r3118 r3119 48 48 #include <tny-simple-list.h> 49 49 #include <tny-merge-folder.h> 50 #include <tny-connection-strategy.h> 50 51 51 52 … … 446 447 camel_object_unref (CAMEL_OBJECT (priv->folder)); 447 448 } else 448 g_critical ("Corrupted CamelFolder instance at (I can't recover from this state, therefore I will leak)\n");449 g_critical ("Corrupted CamelFolder instance at (I can't camel_recover from this state, therefore I will leak)\n"); 449 450 } 450 451 … … 1640 1641 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 1641 1642 TnyFolderChange *change = tny_folder_change_new (self); 1643 TnyConnectionStrategy *constrat; 1642 1644 1643 1645 tny_folder_change_set_new_all_count (change, priv->cached_length); … … 1651 1653 tny_lockable_unlock (info->session->priv->ui_lock); 1652 1654 } 1655 1656 constrat = tny_account_get_connection_strategy (priv->account); 1657 tny_connection_strategy_set_current (constrat, priv->account, self); 1658 g_object_unref (constrat); 1653 1659 1654 1660 tny_idle_stopper_stop (info->stopper); … … 1771 1777 * It's actually very simple: just store all the interesting info in a struct 1772 1778 * launch a thread and keep that struct-instance around. In the callbacks, 1773 * which you stored as function pointers, recover that info and pass it to the1779 * which you stored as function pointers, camel_recover that info and pass it to the 1774 1780 * user of the _async method. 1775 1781 * … … 1831 1837 guint oldlen, oldurlen; 1832 1838 TnyFolderChange *change = NULL; 1839 TnyConnectionStrategy *constrat; 1833 1840 1834 1841 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), … … 1874 1881 notify_folder_observers_about_in_idle (self, change); 1875 1882 g_object_unref (change); 1883 1884 constrat = tny_account_get_connection_strategy (priv->account); 1885 tny_connection_strategy_set_current (constrat, priv->account, self); 1886 g_object_unref (constrat); 1876 1887 1877 1888 return; trunk/libtinymail-camel/tny-camel-store-account.c
r3118 r3119 250 250 } 251 251 252 253 static void 254 let_connection_strat_know (TnyAccount *self) 255 { 256 TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 257 258 if (apriv->status == TNY_CONNECTION_STATUS_CONNECTED_BROKEN) 259 g_idle_add_full (G_PRIORITY_HIGH, 260 constrat_notify_broken, 261 g_object_ref (self), 262 constrat_notify_destroy); 263 else if (apriv->status == TNY_CONNECTION_STATUS_CONNECTED) 264 g_idle_add_full (G_PRIORITY_HIGH, 265 constrat_notify_connect, 266 g_object_ref (self), 267 constrat_notify_destroy); 268 else if (apriv->status == TNY_CONNECTION_STATUS_DISCONNECTED) 269 g_idle_add_full (G_PRIORITY_HIGH, 270 constrat_notify_disconnect, 271 g_object_ref (self), 272 constrat_notify_destroy); 273 274 return; 275 } 276 252 277 static void 253 278 disconnection (CamelService *service, gboolean suc, TnyAccount *self) … … 295 320 TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 296 321 TnyCamelStoreAccountPriv *priv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self); 297 gboolean emit = FALSE; 322 gboolean emit = apriv->retry_connect; 323 324 apriv->retry_connect = FALSE; 298 325 299 326 priv->cant_reuse_iter = TRUE; … … 391 418 if (emit) { 392 419 tny_camel_store_account_do_emit (TNY_CAMEL_STORE_ACCOUNT (self)); 393 394 if (apriv->status == TNY_CONNECTION_STATUS_DISCONNECTED_BROKEN) 395 g_idle_add_full (G_PRIORITY_HIGH, 396 constrat_notify_broken, 397 g_object_ref (self), 398 constrat_notify_destroy); 399 else if (apriv->status == TNY_CONNECTION_STATUS_CONNECTED) 400 g_idle_add_full (G_PRIORITY_HIGH, 401 constrat_notify_connect, 402 g_object_ref (self), 403 constrat_notify_destroy); 404 else if (apriv->status == TNY_CONNECTION_STATUS_DISCONNECTED) 405 g_idle_add_full (G_PRIORITY_HIGH, 406 constrat_notify_disconnect, 407 g_object_ref (self), 408 constrat_notify_destroy); 409 } 410 420 let_connection_strat_know (self); 421 } 411 422 } 412 423 trunk/libtinymail/tny-connection-strategy.c
r3118 r3119 20 20 #include <config.h> 21 21 #include <tny-account.h> 22 #include <tny-folder.h> 22 23 #include <tny-connection-strategy.h> 23 24 #include <tny-list.h> 25 26 27 /** 28 * tny_connection_strategy_set_current: 29 * @self: A #TnyConnectionStrategy instance 30 * @account: the current #TnyAccount instance 31 * @folder: the current #TnyFolder instance 32 * 33 * Used to set the current situation (in case @self wants to restore this 34 * situation in case of a connection event). 35 **/ 36 void 37 tny_connection_strategy_set_current (TnyConnectionStrategy *self, TnyAccount *account, TnyFolder *folder) 38 { 39 #ifdef DBC /* require */ 40 g_assert (TNY_IS_CONNECTION_STRATEGY (self)); 41 g_assert (TNY_IS_ACCOUNT (account)); 42 g_assert (TNY_IS_FOLDER (folder)); 43 44 g_assert (TNY_CONNECTION_STRATEGY_GET_IFACE (self)->set_current_func != NULL); 45 #endif 46 47 TNY_CONNECTION_STRATEGY_GET_IFACE (self)->set_current_func (self, account, folder); 48 49 return; 50 } 24 51 25 52 /** trunk/libtinymail/tny-connection-strategy.h
r3118 r3119 45 45 void (*on_connection_broken_func) (TnyConnectionStrategy *self, TnyAccount *account); 46 46 void (*on_disconnect_func) (TnyConnectionStrategy *self, TnyAccount *account); 47 void (*set_current_func) (TnyConnectionStrategy *self, TnyAccount *account, TnyFolder *folder); 48 47 49 }; 48 50 … … 52 54 void tny_connection_strategy_on_disconnect (TnyConnectionStrategy *self, TnyAccount *account); 53 55 void tny_connection_strategy_on_connection_broken (TnyConnectionStrategy *self, TnyAccount *account); 56 void tny_connection_strategy_set_current (TnyConnectionStrategy *self, TnyAccount *account, TnyFolder *folder); 54 57 55 58 G_END_DECLS trunk/libtinymail/tny-mime-part.c
r3070 r3119 323 323 * Using the tny_msg_rewrite_cache API on a message instance will rewrite its 324 324 * purged mime parts with an empty body (saving storage space). The storage 325 * space is recovered after using tny_msg_rewrite_cache. Only setting a mime325 * space is camel_recovered after using tny_msg_rewrite_cache. Only setting a mime 326 326 * part to purged might not remove it. 327 327 *
