Пример #1
0
// Cleanup sync sessions and activities
// Part of State_Cleanup
void ImapSession::CleanupAfterDisconnect()
{
	if(m_client.get() && !m_client->DisableAccountInProgress()) {
		MojRefCountedPtr<SyncSession> syncSession = m_client->GetSyncSession(m_folderId);

		if(syncSession.get()) {
			MojLogInfo(m_log, "stopping sync session after disconnect");
			// Indicate that the sync session may need to schedule a retry.
			// This will probably get ignored if the sync session is already ending (successful or not).
			syncSession->SetQueueStopped();

			// Stop the sync session
			syncSession->RequestStop(m_syncSessionDoneSlot);
		} else {
			// Schedule push, if necessary
			SchedulePush();
		}
	} else {
		EndActivities();
	}
}