Browse Source

call dc_maybe_network() from a worker thread.

normally, dc_maybe_network() can be called uncoditionally,
however, in fact, it may halt things for some seconds.
this pr is a workaround that make things usable for now.
B. Petersen 5 years ago
parent
commit
5e484c4af9
1 changed files with 10 additions and 3 deletions
  1. 10 3
      deltachat-ios/AppDelegate.swift

+ 10 - 3
deltachat-ios/AppDelegate.swift

@@ -233,10 +233,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
         switch reachability.connection {
         case .wifi, .cellular:
-            dc_maybe_network(mailboxPointer)
-
+            logger.info("network: reachable", reachability.connection.description)
+
+            // call dc_maybe_network() from a worker thread.
+            // normally, dc_maybe_network() can be called uncoditionally,
+            // however, in fact, it may halt things for some seconds.
+            // this pr is a workaround that make things usable for now.
+            DispatchQueue.global(qos: .background).async {
+                dc_maybe_network(mailboxPointer)
+            }
         case .none:
-            break
+            logger.info("network: not reachable")
         }
     }