mirror of https://github.com/M66B/FairEmail.git
Close connection on boundary end
This commit is contained in:
parent
0234827b41
commit
7460f960c3
|
@ -133,7 +133,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
executor.submit(new Runnable() {
|
executor.submit(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
close(state);
|
close(state, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
queue_load(state);
|
queue_load(state);
|
||||||
|
@ -162,7 +162,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
throw ex;
|
throw ex;
|
||||||
|
|
||||||
Log.w("Boundary", ex);
|
Log.w("Boundary", ex);
|
||||||
close(state);
|
close(state, true);
|
||||||
|
|
||||||
// Retry
|
// Retry
|
||||||
load_server(state);
|
load_server(state);
|
||||||
|
@ -529,6 +529,11 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state.index < 0) {
|
||||||
|
Log.i("Boundary server end");
|
||||||
|
close(state, false);
|
||||||
|
}
|
||||||
|
|
||||||
Log.i("Boundary server done");
|
Log.i("Boundary server done");
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
@ -579,28 +584,29 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
executor.submit(new Runnable() {
|
executor.submit(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
close(old);
|
close(old, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void close(State state) {
|
private void close(State state, boolean reset) {
|
||||||
Log.i("Boundary close");
|
Log.i("Boundary close");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (state.ifolder != null)
|
if (state.ifolder != null && state.ifolder.isOpen())
|
||||||
state.ifolder.close();
|
state.ifolder.close();
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e("Boundary", ex);
|
Log.e("Boundary", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (state.iservice != null)
|
if (state.iservice != null && state.iservice.isOpen())
|
||||||
state.iservice.close();
|
state.iservice.close();
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e("Boundary", ex);
|
Log.e("Boundary", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reset)
|
||||||
state.reset();
|
state.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -674,6 +674,10 @@ public class EmailService implements AutoCloseable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isOpen() {
|
||||||
|
return (iservice != null && iservice.isConnected());
|
||||||
|
}
|
||||||
|
|
||||||
public void close() throws MessagingException {
|
public void close() throws MessagingException {
|
||||||
try {
|
try {
|
||||||
if (iservice != null && iservice.isConnected())
|
if (iservice != null && iservice.isConnected())
|
||||||
|
|
Loading…
Reference in New Issue