From a622d7bb47bcffbec7d2e4467468f36971ba0696 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Sat, 16 Oct 2004 00:29:32 +0000 Subject: [PATCH] Fixed the everlasting IMAP crash-on-timeout bug and the everlasting zombie-chain bug. This eliminates all known bugs in the MDR network layer. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9373 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../inbound_protocols/imap/imap_client.cpp | 4 ++++ src/kits/mail/ChainRunner.cpp | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_client.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_client.cpp index a252dc8cd5..c0d36cdd6c 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_client.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_client.cpp @@ -958,7 +958,9 @@ IMAP4Client::ReceiveLine(BString &out) } }else{ // Log an error somewhere instead + runner->Stop(); runner->ShowError("IMAP Timeout."); + return B_TIMED_OUT; } PRINT(("S:%s\n",out.String())); return len; @@ -1120,7 +1122,9 @@ int IMAP4Client::GetResponse(BString &tag, NestedString *parsed_response, bool r } }else{ // Log an error somewhere instead + runner->Stop(); runner->ShowError("IMAP Timeout."); + return B_TIMED_OUT; } return answer; } diff --git a/src/kits/mail/ChainRunner.cpp b/src/kits/mail/ChainRunner.cpp index e8597eff82..d48b637bb0 100644 --- a/src/kits/mail/ChainRunner.cpp +++ b/src/kits/mail/ChainRunner.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -335,7 +336,7 @@ BMailChainRunner::MessageReceived(BMessage *msg) case 'INIT': if (init_addons() == B_OK) break; - case 'STOP': { + case B_QUIT_REQUESTED: { CallCallbacksFor(chain_cb, B_OK); // who knows what the code was? @@ -539,7 +540,13 @@ BMailChainRunner::get_messages(BStringList *list) void BMailChainRunner::Stop() { - PostMessage('STOP'); + BMessageQueue *looper_queue = MessageQueue(); + looper_queue->Lock(); + BMessage *msg; + while (msg = looper_queue->NextMessage()) delete msg; //-- Ensure STOP makes the front of the queue + + PostMessage(B_QUIT_REQUESTED); + looper_queue->Unlock(); }