Browse Source

Fixed race condition

main
M66B 6 years ago
parent
commit
e41cc0cccf
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java

+ 2
- 2
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -214,7 +214,7 @@ public class ServiceSynchronize extends LifecycleService {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
cm.unregisterNetworkCallback(serviceManager); cm.unregisterNetworkCallback(serviceManager);
serviceManager.stop();
serviceManager.onLost(null);
stopForeground(true); stopForeground(true);
@ -1864,7 +1864,7 @@ public class ServiceSynchronize extends LifecycleService {
if (running) { if (running) {
ConnectivityManager cm = getSystemService(ConnectivityManager.class); ConnectivityManager cm = getSystemService(ConnectivityManager.class);
NetworkInfo ani = cm.getActiveNetworkInfo();
NetworkInfo ani = (network == null ? null : cm.getActiveNetworkInfo());
EntityLog.log(ServiceSynchronize.this, "Network active=" + (ani == null ? null : ani.toString())); EntityLog.log(ServiceSynchronize.this, "Network active=" + (ani == null ? null : ani.toString()));
if (ani == null || !ani.isConnected()) { if (ani == null || !ani.isConnected()) {
EntityLog.log(ServiceSynchronize.this, "Network disconnected=" + ani); EntityLog.log(ServiceSynchronize.this, "Network disconnected=" + ani);


Loading…
Cancel
Save