mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +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();
|
||||
succeeded.postValue(true);
|
||||
} catch (ContactExistsException e) {
|
||||
tryToClose(conn);
|
||||
duplicateAuthor = e.getRemoteAuthor();
|
||||
succeeded.postValue(false);
|
||||
} catch (DbException | IOException e) {
|
||||
tryToClose(conn);
|
||||
logException(LOG, WARNING, e);
|
||||
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
|
||||
@Nullable
|
||||
Author getRemoteAuthor() {
|
||||
|
||||
Reference in New Issue
Block a user