Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.0:Ports
kdepim-runtime
0001-IMAP-Resource-handle-disconnection-before-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-IMAP-Resource-handle-disconnection-before-initial-OK.patch of Package kdepim-runtime
From 0398439f3307e54dba29d8abf7f334d09130193d Mon Sep 17 00:00:00 2001 From: David Faure <faure@kde.org> Date: Sat, 21 Apr 2018 18:18:48 +0200 Subject: [PATCH 1/2] IMAP Resource: handle disconnection before initial "OK" from server 1b79b4b in kimap makes connectionLost useful again, as the best way to detect that we managed to connect (so the server actually exists and is (or was) reachable) and then lost connection. Use that instead of the state change to distinguish from the wrong hostname case (where we don't want to retry, we'd loop forever doing that). Test Plan: Expand existing unittest to test 3 different cases of connection lost, all after the initial connect. The next method (shouldNotifyFailureToConnect) ensures that the "wrong hostname" case still works. Differential Revision: https://phabricator.kde.org/D12418 --- resources/imap/autotests/testsessionpool.cpp | 12 ++++++++++++ resources/imap/sessionpool.cpp | 15 ++++----------- resources/imap/sessionpool.h | 1 - 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/resources/imap/sessionpool.cpp b/resources/imap/sessionpool.cpp index e6badaf63..cab732eb6 100644 --- a/resources/imap/sessionpool.cpp +++ b/resources/imap/sessionpool.cpp @@ -202,8 +202,8 @@ void SessionPool::killSession(KIMAP::Session *session, SessionTermination termin Q_ASSERT(false); return; } - QObject::disconnect(session, &KIMAP::Session::stateChanged, - this, &SessionPool::onSessionStateChanged); + QObject::disconnect(session, &KIMAP::Session::connectionLost, + this, &SessionPool::onConnectionLost); m_unusedPool.removeAll(session); m_reservedPool.removeAll(session); m_connectingPool.removeAll(session); @@ -372,8 +372,8 @@ void SessionPool::onPasswordRequestDone(int resultType, const QString &password) m_connectingPool << session; } - QObject::connect(session, &KIMAP::Session::stateChanged, - this, &SessionPool::onSessionStateChanged); + QObject::connect(session, &KIMAP::Session::connectionLost, + this, &SessionPool::onConnectionLost); KIMAP::LoginJob *loginJob = new KIMAP::LoginJob(session); loginJob->setUserName(m_account->userName()); @@ -546,13 +546,6 @@ void SessionPool::onIdDone(KJob *job) declareSessionReady(idJob->session()); } -void SessionPool::onSessionStateChanged(KIMAP::Session::State newState, KIMAP::Session::State oldState) -{ - if (newState == KIMAP::Session::Disconnected && oldState != KIMAP::Session::Disconnected) { - onConnectionLost(); - } -} - void SessionPool::onConnectionLost() { KIMAP::Session *session = static_cast<KIMAP::Session *>(sender()); diff --git a/resources/imap/sessionpool.h b/resources/imap/sessionpool.h index 4daa1477e..fc376551c 100644 --- a/resources/imap/sessionpool.h +++ b/resources/imap/sessionpool.h @@ -106,7 +106,6 @@ private Q_SLOTS: void onNamespacesTestDone(KJob *job); void onIdDone(KJob *job); - void onSessionStateChanged(KIMAP::Session::State newState, KIMAP::Session::State oldState); void onSessionDestroyed(QObject *); private: -- 2.16.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor