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
This commit is contained in:
Clemens Zeidler 2011-03-06 07:36:45 +00:00
parent 2440159a1e
commit faad334022
2 changed files with 12 additions and 4 deletions

View File

@ -214,8 +214,7 @@ status_t
IMAPProtocol::Disconnect() IMAPProtocol::Disconnect()
{ {
ProcessCommand("LOGOUT"); ProcessCommand("LOGOUT");
fIsConnected = false; return _Disconnect();
return fOwnServerConnection.Disconnect();
} }
@ -294,7 +293,7 @@ IMAPProtocol::SendCommand(const char* command, int32 commandId)
int commandLength = strlen(cmd); int commandLength = strlen(cmd);
if (fServerConnection->Write(cmd, commandLength) != commandLength) { if (fServerConnection->Write(cmd, commandLength) != commandLength) {
// we might lost the connection, clear the connection state // we might lost the connection, clear the connection state
Disconnect(); _Disconnect();
return B_ERROR; return B_ERROR;
} }
@ -317,7 +316,7 @@ IMAPProtocol::HandleResponse(int32 commandId, bigtime_t timeout)
TRACE("S:read error %s", line.String()); TRACE("S:read error %s", line.String());
// we might lost the connection, clear the connection state // we might lost the connection, clear the connection state
TRACE("Disconnect\n"); TRACE("Disconnect\n");
Disconnect(); _Disconnect();
return status; return status;
} }
//TRACE("S: %s", line.String()); //TRACE("S: %s", line.String());
@ -410,3 +409,11 @@ IMAPProtocol::_ProcessCommandWithoutAfterQuake(const char* command,
return HandleResponse(commandId, timeout); return HandleResponse(commandId, timeout);
} }
status_t
IMAPProtocol::_Disconnect()
{
fIsConnected = false;
return fOwnServerConnection.Disconnect();
}

View File

@ -112,6 +112,7 @@ private:
status_t _ProcessCommandWithoutAfterQuake( status_t _ProcessCommandWithoutAfterQuake(
const char* command, const char* command,
bigtime_t timeout = kIMAP4ClientTimeout); bigtime_t timeout = kIMAP4ClientTimeout);
status_t _Disconnect();
int32 fCommandId; int32 fCommandId;
std::vector<int32> fOngoingCommands; std::vector<int32> fOngoingCommands;