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
This commit is contained in:
Nathan Whitehorn 2004-10-16 00:29:32 +00:00
parent 85fa73ff32
commit a622d7bb47
2 changed files with 13 additions and 2 deletions

View File

@ -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;
}

View File

@ -16,6 +16,7 @@
#include <Directory.h>
#include <Application.h>
#include <Locker.h>
#include <MessageQueue.h>
#include <MessageFilter.h>
#include <stdio.h>
@ -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();
}