From b06ecefc61581d7048df8b9bcd06896b75a459d0 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 23 Jul 2004 03:37:33 +0000 Subject: ** See bug #61761. 2004-07-22 Not Zed ** See bug #61761. * providers/pop3/camel-pop3-engine.c (camel_pop3_engine_iterate): if we get an io error, move every current/active and queued command to the done queue and mark as failed. svn path=/trunk/; revision=26709 --- camel/providers/pop3/camel-pop3-engine.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'camel/providers') diff --git a/camel/providers/pop3/camel-pop3-engine.c b/camel/providers/pop3/camel-pop3-engine.c index 391d5bd31b..9c3f8423e9 100644 --- a/camel/providers/pop3/camel-pop3-engine.c +++ b/camel/providers/pop3/camel-pop3-engine.c @@ -293,7 +293,7 @@ camel_pop3_engine_iterate(CamelPOP3Engine *pe, CamelPOP3Command *pcwait) /* LOCK */ if (camel_pop3_stream_line(pe->stream, &pe->line, &pe->linelen) == -1) - return -1; + goto ioerror; p = pe->line; switch (p[0]) { @@ -339,7 +339,7 @@ camel_pop3_engine_iterate(CamelPOP3Engine *pe, CamelPOP3Command *pcwait) break; if (camel_stream_write((CamelStream *)pe->stream, pw->data, strlen(pw->data)) == -1) - return -1; + goto ioerror; e_dlist_remove((EDListNode *)pw); @@ -361,6 +361,25 @@ camel_pop3_engine_iterate(CamelPOP3Engine *pe, CamelPOP3Command *pcwait) return 0; return pe->current==NULL?0:1; +ioerror: + /* we assume all outstanding commands are gunna fail now */ + while ( (pw = (CamelPOP3Command*)e_dlist_remhead(&pe->active)) ) { + pw->state = CAMEL_POP3_COMMAND_ERR; + e_dlist_addtail(&pe->done, (EDListNode *)pw); + } + + while ( (pw = (CamelPOP3Command*)e_dlist_remhead(&pe->queue)) ) { + pw->state = CAMEL_POP3_COMMAND_ERR; + e_dlist_addtail(&pe->done, (EDListNode *)pw); + } + + if (pe->current) { + pe->current->state = CAMEL_POP3_COMMAND_ERR; + e_dlist_addtail(&pe->done, (EDListNode *)pe->current); + pe->current = NULL; + } + + return -1; } CamelPOP3Command * -- cgit