The IDLE watching command is supposed to timeout after 29 min if nothing happens. Add an mechanism to not treat this timeout as an
error. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40894 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7aafe6e5e7
commit
8b254785bb
@ -127,7 +127,7 @@ IMAPMailbox::StartWatchingMailbox()
|
||||
//TODO set it when we actually watching
|
||||
atomic_set(&fWatching, 1);
|
||||
|
||||
// refresh every 29 min TODO: check if it works this way
|
||||
// refresh every 29 min
|
||||
bigtime_t timeout = 1000 * 1000 * 60 * 29; // 29 min
|
||||
status_t status;
|
||||
while (true) {
|
||||
@ -136,7 +136,7 @@ IMAPMailbox::StartWatchingMailbox()
|
||||
status = SendCommand("IDLE", commandId);
|
||||
if (status != B_OK)
|
||||
break;
|
||||
status = HandleResponse(commandId, timeout);
|
||||
status = HandleResponse(commandId, timeout, false);
|
||||
ProcessAfterQuacks(kIMAP4ClientTimeout);
|
||||
|
||||
if (atomic_get(&fWatching) == 0)
|
||||
|
@ -303,7 +303,7 @@ IMAPProtocol::SendCommand(const char* command, int32 commandId)
|
||||
|
||||
|
||||
status_t
|
||||
IMAPProtocol::HandleResponse(int32 commandId, bigtime_t timeout)
|
||||
IMAPProtocol::HandleResponse(int32 commandId, bigtime_t timeout, bool disconnectOnTimeout)
|
||||
{
|
||||
status_t commandStatus = B_ERROR;
|
||||
|
||||
@ -312,11 +312,13 @@ IMAPProtocol::HandleResponse(int32 commandId, bigtime_t timeout)
|
||||
BString line;
|
||||
status_t status = fConnectionReader.GetNextLine(line, timeout);
|
||||
if (status != B_OK) {
|
||||
if (status != B_TIMED_OUT)
|
||||
TRACE("S:read error %s", line.String());
|
||||
// we might lost the connection, clear the connection state
|
||||
TRACE("Disconnect\n");
|
||||
_Disconnect();
|
||||
if (status != B_TIMED_OUT) {
|
||||
TRACE("S:read error %s", line.String());
|
||||
_Disconnect();
|
||||
} else if (disconnectOnTimeout) {
|
||||
_Disconnect();
|
||||
}
|
||||
return status;
|
||||
}
|
||||
//TRACE("S: %s", line.String());
|
||||
|
@ -94,7 +94,8 @@ protected:
|
||||
status_t SendCommand(const char* command,
|
||||
int32 commandId);
|
||||
status_t HandleResponse(int32 commandId,
|
||||
bigtime_t timeout = kIMAP4ClientTimeout);
|
||||
bigtime_t timeout = kIMAP4ClientTimeout,
|
||||
bool disconnectOnTimeout = true);
|
||||
void ProcessAfterQuacks(bigtime_t timeout);
|
||||
int32 NextCommandId();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user