Temporarily disable indexing.
authorNot Zed <NotZed@Ximian.com>
Mon, 1 Apr 2002 23:58:53 +0000 (23:58 +0000)
committerMichael Zucci <zucchi@src.gnome.org>
Mon, 1 Apr 2002 23:58:53 +0000 (23:58 +0000)
2002-04-02  Not Zed  <NotZed@Ximian.com>

        * providers/local/camel-local-folder.c
        (camel_local_folder_construct): Temporarily disable indexing.

2002-03-28  Not Zed  <NotZed@Ximian.com>

        * camel-partition-table.c (camel_key_table_lookup): Change range
        checking assert to a warning.

        * providers/pop3/camel-pop3-folder.c (pop3_finalize): Make sure we
        flush out all outstanding commands before finalising, stops being
        finalised while outsanding requests are processed by the store
        finalise.
        (pop3_get_message): Instead of pre-fetching all messages, just
        pre-fetch a maxiumum number at any one time, stops us running out
        of cache fd's.

        * providers/nntp/camel-nntp-folder.c (nntp_folder_init/finalise):
        Setup priv data + locks, & free.

        * providers/imap/camel-imap-folder.c (imap_rescan): Batch all
        message_chagned events into a single folder_changed event
        (otherwise updates can be >>> expensive, like >5 hours for 80K
        messages changing!).  Alternately it could use folder
        freeze/unfreeze perhaps.

2002-03-27  Not Zed  <NotZed@Ximian.com>

        * providers/imap/camel-imap-store.c (imap_keepalive): Pass an
        exception to called code so it behaves properly since it uses the
        passed exception to check returns.

camel/ChangeLog
camel/camel-mime-filter-charset.c
camel/camel-partition-table.c
camel/camel-remote-store.c
camel/providers/imap/camel-imap-folder.c
camel/providers/imap/camel-imap-store.c
camel/providers/local/camel-local-folder.c
camel/providers/nntp/camel-nntp-folder.c
camel/providers/pop3/camel-pop3-folder.c

index 78ec25c..5291935 100644 (file)
@@ -1,3 +1,36 @@
+2002-04-02  Not Zed  <NotZed@Ximian.com>
+
+       * providers/local/camel-local-folder.c
+       (camel_local_folder_construct): Temporarily disable indexing.
+
+2002-03-28  Not Zed  <NotZed@Ximian.com>
+
+       * camel-partition-table.c (camel_key_table_lookup): Change range
+       checking assert to a warning.
+
+       * providers/pop3/camel-pop3-folder.c (pop3_finalize): Make sure we
+       flush out all outstanding commands before finalising, stops being
+       finalised while outsanding requests are processed by the store
+       finalise.
+       (pop3_get_message): Instead of pre-fetching all messages, just
+       pre-fetch a maxiumum number at any one time, stops us running out
+       of cache fd's.
+       
+       * providers/nntp/camel-nntp-folder.c (nntp_folder_init/finalise):
+       Setup priv data + locks, & free.
+
+       * providers/imap/camel-imap-folder.c (imap_rescan): Batch all
+       message_chagned events into a single folder_changed event
+       (otherwise updates can be >>> expensive, like >5 hours for 80K
+       messages changing!).  Alternately it could use folder
+       freeze/unfreeze perhaps.
+
+2002-03-27  Not Zed  <NotZed@Ximian.com>
+
+       * providers/imap/camel-imap-store.c (imap_keepalive): Pass an
+       exception to called code so it behaves properly since it uses the
+       passed exception to check returns.
+
 2002-04-01  Dan Winship  <danw@ximian.com>
 
        * providers/imap/Makefile.am (libcamelimap_la_LDFLAGS): Use
index d3a02ff..f30047c 100644 (file)
@@ -179,6 +179,12 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
          bytes for a multibyte sequence, if not, we're in trouble.
        */
 
+       /* This is to fix a bug in at least 1 version of glibc iconv: we get EINVAL and
+          it reads past the input and returns a converted length of -1 ... so discard
+          any overruns as failed */
+       if (((int)inlen) < 0)
+               inlen = 0;
+
        if (inlen>0) {
                camel_mime_filter_backup(mf, inbuf, inlen);
        }
index 4893679..c386cbc 100644 (file)
@@ -141,11 +141,19 @@ lookup word, if nameid is deleted, mark it in wordlist as unused and mark for wr
 
 /* ********************************************************************** */
 
+void
+camel_break_here(void)
+{
+}
+
 /* This simple hash seems to work quite well */
 static camel_hash_t hash_key(const char *key)
 {
        camel_hash_t hash = 0xABADF00D;
 
+       if (strcmp(key, "4852") == 0)
+               camel_break_here();
+
        while (*key) {
                hash = hash * (*key) ^ (*key);
                key++;
@@ -850,8 +858,15 @@ camel_key_table_lookup(CamelKeyTable *ki, camel_key_t keyid, char **keyp, unsign
 
        kb = (CamelKeyBlock *)&bl->data;
 
-       g_assert(kb->used < 127);
+#if 1
+       g_assert(kb->used < 127); /* this should be more accurate */
        g_assert(index < kb->used);
+#else
+       if (kb->used >=127 || index >= kb->used) {
+               g_warning("Block %x: Invalid index or content: index %d used %d\n", blockid, index, kb->used);
+               return 0;
+       }
+#endif
 
        CAMEL_KEY_TABLE_LOCK(ki, lock);
 
index 08308c8..f91c28c 100644 (file)
@@ -272,7 +272,7 @@ remote_connect (CamelService *service, CamelException *ex)
        if (CRSC (store)->keepalive) {
                CamelSession *session = camel_service_get_session (CAMEL_SERVICE (store));
                
-               store->timeout_id = camel_session_register_timeout (session, 10 * 60 * 1000
+               store->timeout_id = camel_session_register_timeout (session, 30 * 1000 /* FIXME: 10 * 60 * 1000 */
                                                                    timeout_cb, 
                                                                    store);
        }
index 5db154a..eb1fcd8 100644 (file)
@@ -451,7 +451,8 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
        CamelImapMessageInfo *iinfo;
        GArray *removed;
        gboolean ok;
-       
+       CamelFolderChangeInfo *changes = NULL;
+
        CAMEL_IMAP_STORE_ASSERT_LOCKED (store, command_lock);
        imap_folder->need_rescan = FALSE;
        
@@ -541,15 +542,20 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
                        
                        info->flags = (info->flags | server_set) & ~server_cleared;
                        iinfo->server_flags = new[i].flags;
-                       
-                       camel_object_trigger_event (CAMEL_OBJECT (folder),
-                                                   "message_changed",
-                                                   new[i].uid);
+
+                       if (changes == NULL)
+                               changes = camel_folder_change_info_new();
+                       camel_folder_change_info_change_uid(changes, new[i].uid);
                }
                
                camel_folder_summary_info_free (folder->summary, info);
                g_free (new[i].uid);
        }
+
+       if (changes) {
+               camel_object_trigger_event(CAMEL_OBJECT (folder), "folder_changed", changes);
+               camel_folder_change_info_free(changes);
+       }
        
        seq = i + 1;
        
index 8253e3b..2c2d051 100644 (file)
@@ -1845,22 +1845,27 @@ imap_keepalive (CamelRemoteStore *store)
 {
        CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
        CamelImapResponse *response;
-       
+       CamelException *ex;
+
        /* FIXME: should this check to see if we are online? */
        
        /* Note: the idea here is to sync the flags of our currently
           selected folder if there have been changes... */
-       
+       ex = NULL;
+       /*ex = camel_exception_new();*/
        if (imap_store->current_folder && folder_flags_have_changed (imap_store->current_folder)) {
-               camel_folder_sync (imap_store->current_folder, FALSE, NULL);
+               camel_folder_sync (imap_store->current_folder, FALSE, ex);
+               /*camel_exception_clear(ex);*/
        }
        
        /* ...but we also want to NOOP so that we get an untagged response. */
        
        CAMEL_IMAP_STORE_LOCK (store, command_lock);
        
-       response = camel_imap_command (imap_store, NULL, NULL, "NOOP");
+       response = camel_imap_command (imap_store, NULL, ex, "NOOP");
        camel_imap_response_free (imap_store, response);
        
        CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+
+       /*camel_exception_free(ex);*/
 }
index 0344fc8..a9cb464 100644 (file)
@@ -216,6 +216,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
           the old-format 'ibex' files that might be lying around */
        unlink(lf->index_path);
 
+#if 1
+       forceindex = FALSE;
+#else
        /* if we have no/invalid index file, force it */
        forceindex = camel_text_index_check(lf->index_path) == -1;
        if (flags & CAMEL_STORE_FOLDER_BODY_INDEX) {
@@ -236,7 +239,7 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
                        camel_text_index_remove(lf->index_path);
                forceindex = FALSE;
        }
-
+#endif
        lf->flags = flags;
 
        folder->summary = (CamelFolderSummary *)CLOCALF_CLASS(lf)->create_summary(lf->summary_path, lf->folder_path, lf->index);
index 47d3111..cfe1466 100644 (file)
@@ -259,13 +259,28 @@ nntp_folder_search_free(CamelFolder *folder, GPtrArray *result)
 static void           
 nntp_folder_init(CamelNNTPFolder *nntp_folder, CamelNNTPFolderClass *klass)
 {
+       struct _CamelNNTPFolderPrivate *p;
+
        nntp_folder->changes = camel_folder_change_info_new();
+#ifdef ENABLE_THREADS
+       p = nntp_folder->priv = g_malloc0(sizeof(*nntp_folder->priv));
+       p->search_lock = g_mutex_new();
+       p->cache_lock = g_mutex_new();
+#endif
 }
 
 static void           
 nntp_folder_finalise (CamelNNTPFolder *nntp_folder)
 {
+       struct _CamelNNTPFolderPrivate *p;
+
        g_free(nntp_folder->storage_path);
+#ifdef ENABLE_THREADS
+       p = nntp_folder->priv;
+       g_mutex_free(p->search_lock);
+       g_mutex_free(p->cache_lock);
+       g_free(p);
+#endif
 }
 
 static void
index 777f81f..27fa98c 100644 (file)
@@ -99,9 +99,16 @@ pop3_finalize (CamelObject *object)
 {
        CamelPOP3Folder *pop3_folder = CAMEL_POP3_FOLDER (object);
        CamelPOP3FolderInfo **fi = (CamelPOP3FolderInfo **)pop3_folder->uids->pdata;
+       CamelPOP3Store *pop3_store = (CamelPOP3Store *)((CamelFolder *)pop3_folder)->parent_store;
        int i;
 
        for (i=0;i<pop3_folder->uids->len;i++,fi++) {
+               if (fi[0]->cmd) {
+                       while (camel_pop3_engine_iterate(pop3_store->engine, fi[0]->cmd) > 0)
+                               ;
+                       camel_pop3_engine_command_free(pop3_store->engine, fi[0]->cmd);
+               }
+
                g_free(fi[0]->uid);
                g_free(fi[0]);
        }
@@ -402,7 +409,7 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
        CamelPOP3Command *pcr;
        CamelPOP3FolderInfo *fi;
        char buffer[1];
-       int ok, i;
+       int ok, i, last;
        CamelStream *stream = NULL;
 
        fi = uid_to_fi(pop3_folder, uid);
@@ -458,10 +465,13 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
                fi->err = EIO;
                pcr = camel_pop3_engine_command_new(pop3_store->engine, CAMEL_POP3_COMMAND_MULTI, cmd_tocache, fi, "RETR %u\r\n", fi->id);
 
-               /* Also initiate retrieval of all following messages, assume we'll be receiving them */
+               /* Also initiate retrieval of some of the following messages, assume we'll be receiving them */
                if (pop3_store->cache != NULL) {
+                       /* This should keep track of the last one retrieved, also how many are still
+                          oustanding incase of random access on large folders */
                        i = fi_to_index(pop3_folder, fi)+1;
-                       for (;i<pop3_folder->uids->len;i++) {
+                       last = MIN(i+10, pop3_folder->uids->len);
+                       for (;i<last;i++) {
                                CamelPOP3FolderInfo *pfi = pop3_folder->uids->pdata[i];
                                
                                if (pfi->uid && pfi->cmd == NULL) {