From faad334022bdf56f1f10f6b5d2a46e61bc353a5b Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 6 Mar 2011 07:36:45 +0000 Subject: [PATCH] Fix endless loop when try to logout and the connection is already lost. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40830 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../imap/imap_lib/IMAPProtocol.cpp | 15 +++++++++++---- .../imap/imap_lib/IMAPProtocol.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp index 44ca668ec1..b66886e465 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp @@ -214,8 +214,7 @@ status_t IMAPProtocol::Disconnect() { ProcessCommand("LOGOUT"); - fIsConnected = false; - return fOwnServerConnection.Disconnect(); + return _Disconnect(); } @@ -294,7 +293,7 @@ IMAPProtocol::SendCommand(const char* command, int32 commandId) int commandLength = strlen(cmd); if (fServerConnection->Write(cmd, commandLength) != commandLength) { // we might lost the connection, clear the connection state - Disconnect(); + _Disconnect(); return B_ERROR; } @@ -317,7 +316,7 @@ IMAPProtocol::HandleResponse(int32 commandId, bigtime_t timeout) TRACE("S:read error %s", line.String()); // we might lost the connection, clear the connection state TRACE("Disconnect\n"); - Disconnect(); + _Disconnect(); return status; } //TRACE("S: %s", line.String()); @@ -410,3 +409,11 @@ IMAPProtocol::_ProcessCommandWithoutAfterQuake(const char* command, return HandleResponse(commandId, timeout); } + + +status_t +IMAPProtocol::_Disconnect() +{ + fIsConnected = false; + return fOwnServerConnection.Disconnect(); +} diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.h index e23a255603..ec51427e4c 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.h @@ -112,6 +112,7 @@ private: status_t _ProcessCommandWithoutAfterQuake( const char* command, bigtime_t timeout = kIMAP4ClientTimeout); + status_t _Disconnect(); int32 fCommandId; std::vector fOngoingCommands;