diff options
author | Not Zed <NotZed@Ximian.com> | 2004-09-29 10:02:03 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-09-29 10:02:03 +0800 |
commit | 502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b (patch) | |
tree | 3ce1f7f190d896ca20b088e9c3ca8f4ede4a83e6 /camel/providers/imapp | |
parent | 89ae8478ced70367dd279dfc1925818eb3dfe8c3 (diff) | |
download | gsoc2013-evolution-502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b.tar gsoc2013-evolution-502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b.tar.gz gsoc2013-evolution-502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b.tar.bz2 gsoc2013-evolution-502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b.tar.lz gsoc2013-evolution-502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b.tar.xz gsoc2013-evolution-502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b.tar.zst gsoc2013-evolution-502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b.zip |
** See bug #66509.
2004-09-28 Not Zed <NotZed@Ximian.com>
** See bug #66509.
* providers/nntp/camel-nntp-store.c (camel_nntp_command): if we
get an error selecting the folder, disconnect/include it in the
re-try loop.
(camel_nntp_command): don't set the exception based on errno,
exception processing is already done. don't clear it if we're on
the 3rd retry.
2004-09-27 Not Zed <NotZed@Ximian.com>
* providers/nntp/camel-nntp-store.c (nntp_get_folder_info): don't
do any locking here.
(nntp_store_get_folder_info_all): move the locking here.
(nntp_store_get_subscribed_folder_info): and some here too.
* providers/nntp/camel-nntp-store.c:
* providers/nntp/camel-nntp-folder.c: Remove nntp command_lock and
just use the service connect lock for serialisation.
svn path=/trunk/; revision=27419
Diffstat (limited to 'camel/providers/imapp')
-rw-r--r-- | camel/providers/imapp/ChangeLog | 13 | ||||
-rw-r--r-- | camel/providers/imapp/camel-imapp-engine.c | 144 | ||||
-rw-r--r-- | camel/providers/imapp/camel-imapp-engine.h | 7 |
3 files changed, 73 insertions, 91 deletions
diff --git a/camel/providers/imapp/ChangeLog b/camel/providers/imapp/ChangeLog new file mode 100644 index 0000000000..766c24b81a --- /dev/null +++ b/camel/providers/imapp/ChangeLog @@ -0,0 +1,13 @@ +2004-09-28 Not Zed <NotZed@Ximian.com> + + * camel-imapp-engine.c (camel_imapp_engine_command_free): assume + the command isn't in a list now. + (cie_worker): worker thread code. + + * camel-imapp-engine.h: make the imappcommand a + message. + +2004-09-28 Not Zed <NotZed@Ximian.com> + + * added new changelog. + diff --git a/camel/providers/imapp/camel-imapp-engine.c b/camel/providers/imapp/camel-imapp-engine.c index 798fb3161c..e28843217d 100644 --- a/camel/providers/imapp/camel-imapp-engine.c +++ b/camel/providers/imapp/camel-imapp-engine.c @@ -42,9 +42,10 @@ object_init(CamelIMAPPEngine *ie, CamelIMAPPEngineClass *ieclass) { ie->handlers = g_hash_table_new(g_str_hash, g_str_equal); e_dlist_init(&ie->active); - e_dlist_init(&ie->queue); e_dlist_init(&ie->done); + ie->port = e_msgport_new(); + ie->tagprefix = ieclass->tagprefix; ieclass->tagprefix++; if (ieclass->tagprefix > 'Z') @@ -650,7 +651,7 @@ camel_imapp_engine_command_complete(CamelIMAPPEngine *imap, struct _CamelIMAPPCo ic->complete_data = data; } -/* FIXME: make imap command's refcounted */ +/* FIXME: make imap command's refcounted? */ void camel_imapp_engine_command_free (CamelIMAPPEngine *imap, CamelIMAPPCommand *ic) { @@ -659,60 +660,18 @@ camel_imapp_engine_command_free (CamelIMAPPEngine *imap, CamelIMAPPCommand *ic) if (ic == NULL) return; - /* validity check - we cant' free items still in any queue ... */ - /* maybe we should just have another queue to keep them? */ - { - CamelIMAPPCommand *iw; - int found = 0; - - iw = (CamelIMAPPCommand *)imap->active.head; - while (iw->next) { - if (iw == ic) { - found = 1; - g_warning("command '%s' still in active queue", iw->name); - break; - } - iw = iw->next; - } - iw = (CamelIMAPPCommand *)imap->queue.head; - while (iw->next) { - if (iw == ic) { - found = 1; - g_warning("command '%s' still in waiting queue", iw->name); - break; - } - iw = iw->next; - } - iw = (CamelIMAPPCommand *)imap->done.head; - while (iw->next) { - if (iw == ic) { - found = 1; - break; - } - iw = iw->next; - } - if (!found) { - g_warning("command '%s' not found anywhere", ic->name); - abort(); - } - } - - e_dlist_remove((EDListNode *)ic); + /* Note the command must not be in any queue? */ if (ic->mem) camel_object_unref((CamelObject *)ic->mem); imap_free_status(ic->status); g_free(ic->select); - cp = (CamelIMAPPCommandPart *)ic->parts.head; - cn = cp->next; - while (cn) { + while ( (cp = ((CamelIMAPPCommandPart *)e_dlist_remhead(&ic->parts))) ) { g_free(cp->data); if (cp->ob) camel_object_unref(cp->ob); g_free(cp); - cp = cn; - cn = cn->next; } g_free(ic); @@ -724,51 +683,12 @@ camel_imapp_engine_command_queue(CamelIMAPPEngine *imap, CamelIMAPPCommand *ic) { CamelIMAPPCommandPart *cp; + g_assert(ic->msg.reply_port); + if (ic->mem) imap_engine_command_complete(imap, ic); - /* FIXME: remove select stuff */ - - /* see if we need to pre-queue a select command to select the right folder first */ - if (ic->select && (imap->last_select == NULL || strcmp(ic->select, imap->last_select) != 0)) { - CamelIMAPPCommand *select; - - /* of course ... we can't do anything like store/search if we have to select - first, because it'll mess up all the sequence numbers ... hrm ... bugger */ - - select = camel_imapp_engine_command_new(imap, "SELECT", NULL, "SELECT %s", ic->select); - g_free(imap->last_select); - imap->last_select = g_strdup(ic->select); - camel_imapp_engine_command_queue(imap, select); - /* how does it get freed? handle inside engine? */ - } - - /* first, check if command can be sent yet ... queue if not */ - if (imap->literal != NULL) { - printf("%p: queueing while literal active\n", ic); - e_dlist_addtail(&imap->queue, (EDListNode *)ic); - return; - } - - cp = (CamelIMAPPCommandPart *)ic->parts.head; - g_assert(cp); - ic->current = cp; - - /* how to handle exceptions here? */ - - printf("queueing command \"%c%05u %s\"\n", imap->tagprefix, ic->tag, cp->data); - camel_stream_printf((CamelStream *)imap->stream, "%c%05u %s\r\n", imap->tagprefix, ic->tag, cp->data); - - if (cp->type & CAMEL_IMAPP_COMMAND_CONTINUATION) { - printf("%p: active literal\n", ic); - g_assert(cp->next); - imap->literal = ic; - e_dlist_addtail(&imap->active, (EDListNode *)ic); - } else { - printf("%p: active non-literal\n", ic); - g_assert(cp->next && cp->next->next == NULL); - e_dlist_addtail(&imap->active, (EDListNode *)ic); - } + e_msgport_put(imap->port, (EMsg *)ic); } CamelIMAPPCommand * @@ -1077,6 +997,54 @@ imap_engine_command_addv(CamelIMAPPEngine *imap, CamelIMAPPCommand *ic, const ch } +static void * +cie_worker(void *data) +{ + /* FIXME: remove select stuff */ + + /* see if we need to pre-queue a select command to select the right folder first */ + if (ic->select && (imap->last_select == NULL || strcmp(ic->select, imap->last_select) != 0)) { + CamelIMAPPCommand *select; + + /* of course ... we can't do anything like store/search if we have to select + first, because it'll mess up all the sequence numbers ... hrm ... bugger */ + + select = camel_imapp_engine_command_new(imap, "SELECT", NULL, "SELECT %s", ic->select); + g_free(imap->last_select); + imap->last_select = g_strdup(ic->select); + camel_imapp_engine_command_queue(imap, select); + /* how does it get freed? handle inside engine? */ + } + + /* first, check if command can be sent yet ... queue if not */ + if (imap->literal != NULL) { + printf("%p: queueing while literal active\n", ic); + e_dlist_addtail(&imap->queue, (EDListNode *)ic); + return; + } + + cp = (CamelIMAPPCommandPart *)ic->parts.head; + g_assert(cp); + ic->current = cp; + + /* how to handle exceptions here? */ + + printf("queueing command \"%c%05u %s\"\n", imap->tagprefix, ic->tag, cp->data); + camel_stream_printf((CamelStream *)imap->stream, "%c%05u %s\r\n", imap->tagprefix, ic->tag, cp->data); + + if (cp->type & CAMEL_IMAPP_COMMAND_CONTINUATION) { + printf("%p: active literal\n", ic); + g_assert(cp->next); + imap->literal = ic; + e_dlist_addtail(&imap->active, (EDListNode *)ic); + } else { + printf("%p: active non-literal\n", ic); + g_assert(cp->next && cp->next->next == NULL); + e_dlist_addtail(&imap->active, (EDListNode *)ic); + } +} + + /* here temporarily while its experimental */ diff --git a/camel/providers/imapp/camel-imapp-engine.h b/camel/providers/imapp/camel-imapp-engine.h index 5f74d0654a..4064d9957d 100644 --- a/camel/providers/imapp/camel-imapp-engine.h +++ b/camel/providers/imapp/camel-imapp-engine.h @@ -46,10 +46,8 @@ struct _CamelIMAPPCommandPart { typedef int (*CamelIMAPPEngineFunc)(struct _CamelIMAPPEngine *engine, guint32 id, void *data); typedef void (*CamelIMAPPCommandFunc)(struct _CamelIMAPPEngine *engine, struct _CamelIMAPPCommand *, void *data); -/* FIXME: make this refcounted */ struct _CamelIMAPPCommand { - struct _CamelIMAPPCommand *next; - struct _CamelIMAPPCommand *prev; + EMsg msg; const char *name; /* command name/type (e.g. FETCH) */ @@ -99,6 +97,9 @@ typedef enum _camel_imapp_engine_state_t { struct _CamelIMAPPEngine { CamelObject parent_object; + /* incoming requests */ + EMsgPort *port; + CamelIMAPPStream *stream; camel_imapp_engine_state_t state; |