mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 07:09:56 +01:00
Try to close connection if contact exchange fails.
This commit is contained in:
@@ -66,15 +66,26 @@ class ContactExchangeViewModel extends AndroidViewModel {
|
|||||||
remoteAuthor = contact.getAuthor();
|
remoteAuthor = contact.getAuthor();
|
||||||
succeeded.postValue(true);
|
succeeded.postValue(true);
|
||||||
} catch (ContactExistsException e) {
|
} catch (ContactExistsException e) {
|
||||||
|
tryToClose(conn);
|
||||||
duplicateAuthor = e.getRemoteAuthor();
|
duplicateAuthor = e.getRemoteAuthor();
|
||||||
succeeded.postValue(false);
|
succeeded.postValue(false);
|
||||||
} catch (DbException | IOException e) {
|
} catch (DbException | IOException e) {
|
||||||
|
tryToClose(conn);
|
||||||
logException(LOG, WARNING, e);
|
logException(LOG, WARNING, e);
|
||||||
succeeded.postValue(false);
|
succeeded.postValue(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tryToClose(DuplexTransportConnection conn) {
|
||||||
|
try {
|
||||||
|
conn.getReader().dispose(true, true);
|
||||||
|
conn.getWriter().dispose(true);
|
||||||
|
} catch (IOException e) {
|
||||||
|
logException(LOG, WARNING, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
@Nullable
|
@Nullable
|
||||||
Author getRemoteAuthor() {
|
Author getRemoteAuthor() {
|
||||||
|
|||||||
Reference in New Issue
Block a user