From 502d1ef88e6b75c8a163e30dd3c804cdcd91ba6b Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 29 Sep 2004 02:02:03 +0000 Subject: ** See bug #66509. 2004-09-28 Not Zed ** 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 * 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 --- camel/providers/imapp/ChangeLog | 13 +++ camel/providers/imapp/camel-imapp-engine.c | 144 +++++++++++------------------ camel/providers/imapp/camel-imapp-engine.h | 7 +- 3 files changed, 73 insertions(+), 91 deletions(-) create mode 100644 camel/providers/imapp/ChangeLog (limited to 'camel/providers/imapp') 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 + + * 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 + + * 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; -- cgit