hrev52541 adds 1 changeset to branch 'master'
old head: a4ba4323529778ffa15c4285cd40d210c666363d
new head: a6a126624030cdb616f2b71525e1fca827a41037
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=a6a126624030+%5Ea4ba43235297
----------------------------------------------------------------------------
a6a126624030: mail: IMAP fix deadlock when connection failed
fLocker must be released in IMAPConnectionWorker::_Worker() before
WorkerQuit() call.
Change-Id: I1e622a711fa3349986560af1118b158696025844
Reviewed-on: https://review.haiku-os.org/705
Reviewed-by: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
[ Peter Kosyh <p.kosyh@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev52541
Commit: a6a126624030cdb616f2b71525e1fca827a41037
URL: https://git.haiku-os.org/haiku/commit/?id=a6a126624030
Author: Peter Kosyh <p.kosyh@xxxxxxxxx>
Date: Sat Nov 17 13:24:20 2018 UTC
Committer: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Commit-Date: Sat Nov 17 16:26:35 2018 UTC
----------------------------------------------------------------------------
1 file changed, 9 insertions(+), 12 deletions(-)
.../imap/IMAPConnectionWorker.cpp | 21 +++++++++-----------
----------------------------------------------------------------------------
diff --git
a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp
b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp
index f30625e977..ef870c4528 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp
@@ -717,6 +717,8 @@ IMAPConnectionWorker::MessageExpungeReceived(uint32 index)
status_t
IMAPConnectionWorker::_Worker()
{
+ status_t status = B_OK;
+
while (!fStopped) {
BAutolock locker(fLocker);
@@ -736,21 +738,16 @@ IMAPConnectionWorker::_Worker()
CommandDeleter deleter(*this, command);
- status_t status = B_OK;
-
- if (dynamic_cast<QuitCommand*>(command) == NULL) // do not
connect on QuitCommand
+ if (dynamic_cast<QuitCommand*>(command) == NULL) { // do not
connect on QuitCommand
status = _Connect();
-
- if (status != B_OK) {
- fOwner.WorkerQuit(this);
- return status;
+ if (status != B_OK)
+ break;
}
status = command->Process(*this);
- if (status != B_OK) {
- fOwner.WorkerQuit(this);
- return status;
- }
+ if (status != B_OK)
+ break;
+
if (!command->IsDone()) {
deleter.Detach();
command->SetContinuation();
@@ -759,7 +756,7 @@ IMAPConnectionWorker::_Worker()
}
fOwner.WorkerQuit(this);
- return B_OK;
+ return status;
}