ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #00157
[Merge] lp:~mzanetti/reminders-app/better-reset-connection into lp:reminders-app
Michael Zanetti has proposed merging lp:~mzanetti/reminders-app/better-reset-connection into lp:reminders-app.
Commit message:
Properly reset the connection when it fails.
Seems just closing and reopening is not enough. We need to create a new socket.
Requested reviews:
Ubuntu Reminders app developers (reminders-app-dev)
For more details, see:
https://code.launchpad.net/~mzanetti/reminders-app/better-reset-connection/+merge/251329
--
Your team Ubuntu Reminders app developers is requested to review the proposed merge of lp:~mzanetti/reminders-app/better-reset-connection into lp:reminders-app.
=== modified file 'src/libqtevernote/evernoteconnection.cpp'
--- src/libqtevernote/evernoteconnection.cpp 2015-02-26 22:47:10 +0000
+++ src/libqtevernote/evernoteconnection.cpp 2015-02-27 21:34:23 +0000
@@ -147,6 +147,7 @@
void EvernoteConnection::disconnectFromEvernote()
{
+ qDebug() << "[Connection] Disconnecting from Evernote.";
if (!isConnected()) {
qWarning() << "Not connected. Can't disconnect.";
return;
@@ -201,35 +202,34 @@
return;
}
+ qDebug() << "[Connection] Connecting to Evernote:" << m_hostname;
+
m_errorMessage.clear();
emit errorChanged();
if (m_token.isEmpty()) {
- qWarning() << "Can't connect to Evernote. No token set.";
+ qWarning() << "[Connection] Can't connect to Evernote. No token set.";
return;
}
if (m_hostname.isEmpty()) {
- qWarning() << "Can't connect to Evernote. No hostname set.";
+ qWarning() << "[Connection] Can't connect to Evernote. No hostname set.";
}
- qDebug() << "******* Connecting *******";
- qDebug() << "hostname:" << m_hostname;
-// qDebug() << "token:" << m_token;
setupUserStore();
bool ok = connectUserStore();
if (!ok) {
- qWarning() << "Error connecting User Store. Cannot continue.";
+ qWarning() << "[Connection] Error connecting User Store. Cannot continue.";
return;
}
setupNotesStore();
ok = connectNotesStore();
if (!ok) {
- qWarning() << "Error connecting Notes Store. Cannot continue.";
+ qWarning() << "[Connection] Error connecting Notes Store. Cannot continue.";
return;
}
- qDebug() << "Connected!";
+ qDebug() << "[Connection] Connected!";
emit isConnectedChanged();
}
@@ -416,6 +416,7 @@
void EvernoteConnection::startNextJob()
{
+ qDebug() << "[JobQueue] Job done:" << m_currentJob->toString();
m_currentJob = 0;
startJobQueue();
}
=== modified file 'src/libqtevernote/jobs/evernotejob.cpp'
--- src/libqtevernote/jobs/evernotejob.cpp 2015-02-26 22:47:10 +0000
+++ src/libqtevernote/jobs/evernotejob.cpp 2015-02-27 21:34:23 +0000
@@ -78,7 +78,7 @@
} catch (const TTransportException & e) {
qWarning() << "TTransportException in" << metaObject()->className() << e.what();
if (tryCount < 2) {
- qWarning() << "Resetting connection...";
+ qWarning() << "[JobQueue] Resetting connection...";
try {
resetConnection();
} catch(...) {}
=== modified file 'src/libqtevernote/jobs/notesstorejob.cpp'
--- src/libqtevernote/jobs/notesstorejob.cpp 2015-02-26 22:47:10 +0000
+++ src/libqtevernote/jobs/notesstorejob.cpp 2015-02-27 21:34:23 +0000
@@ -29,18 +29,8 @@
void NotesStoreJob::resetConnection()
{
- try {
- EvernoteConnection::instance()->m_notesStoreHttpClient->readEnd();
- } catch(...) {}
- try {
- EvernoteConnection::instance()->m_notesStoreHttpClient->flush();
- } catch(...) {}
- if (EvernoteConnection::instance()->m_notesStoreHttpClient->isOpen()) {
- try {
- EvernoteConnection::instance()->m_notesStoreHttpClient->close();
- } catch(...) {}
- }
- EvernoteConnection::instance()->m_notesStoreHttpClient->open();
+ EvernoteConnection::instance()->setupNotesStore();
+ EvernoteConnection::instance()->connectNotesStore();
}
evernote::edam::NoteStoreClient *NotesStoreJob::client() const
=== modified file 'src/libqtevernote/jobs/userstorejob.cpp'
--- src/libqtevernote/jobs/userstorejob.cpp 2014-04-30 21:53:07 +0000
+++ src/libqtevernote/jobs/userstorejob.cpp 2015-02-27 21:34:23 +0000
@@ -29,16 +29,8 @@
void UserStoreJob::resetConnection()
{
- if (EvernoteConnection::instance()->m_userStoreHttpClient->isOpen()) {
- EvernoteConnection::instance()->m_userStoreHttpClient->close();
- }
- try {
- EvernoteConnection::instance()->m_userStoreHttpClient->readEnd();
- } catch(...) {}
- try {
- EvernoteConnection::instance()->m_userStoreHttpClient->flush();
- } catch(...) {}
- EvernoteConnection::instance()->m_userStoreHttpClient->open();
+ EvernoteConnection::instance()->setupUserStore();
+ EvernoteConnection::instance()->connectUserStore();
}
evernote::edam::UserStoreClient *UserStoreJob::client() const
Follow ups