summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-08-31 16:25:27 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-08-31 16:25:27 +0300
commit27fed83083fc0877fcc678d62d76678cd6bf985f (patch)
tree6a2141d01c5419559a1f8c00b9e68c0cb3c99ddd /src
parentDon't block on empty from token (diff)
downloadnheko-27fed83083fc0877fcc678d62d76678cd6bf985f.tar.xz
Retry initial sync on generic network errors (#422)
Diffstat (limited to 'src')
-rw-r--r--src/ChatPage.cpp6
-rw-r--r--src/MainWindow.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 9596d561..719c697b 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -1169,6 +1169,12 @@ ChatPage::initialSyncHandler(const mtx::responses::Sync &res, mtx::http::Request
 
                 nhlog::net()->error("initial sync error: {} {}", status_code, err_code);
 
+                // non http related errors
+                if (status_code <= 0 || status_code >= 600) {
+                        startInitialSync();
+                        return;
+                }
+
                 switch (status_code) {
                 case 502:
                 case 504:
diff --git a/src/MainWindow.h b/src/MainWindow.h
index 1953ba0e..0931099d 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -105,6 +105,9 @@ private slots:
         //! Show the login page in the main window.
         void showLoginPage()
         {
+                if (modal_)
+                        modal_->hide();
+
                 pageStack_->addWidget(login_page_);
                 pageStack_->setCurrentWidget(login_page_);
         }