mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Unify introduction response methods and handle ProtocolStateException
It is possible that a remote DECLINE message arrives short before the user responds to the introduction. This will cause a ProtocolStateException which (for now) is just caught and a generic (existing) error message will be shown.
This commit is contained in:
@@ -865,7 +865,8 @@ introductionOnboardingSeen();
|
||||
"Unknown Request Type");
|
||||
}
|
||||
loadMessages();
|
||||
} catch (DbException | FormatException e) {
|
||||
} catch (DbException e) {
|
||||
// TODO use more generic error message
|
||||
introductionResponseError();
|
||||
if (LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
@@ -898,11 +899,14 @@ introductionOnboardingSeen();
|
||||
|
||||
@DatabaseExecutor
|
||||
private void respondToIntroductionRequest(SessionId sessionId,
|
||||
boolean accept, long time) throws DbException, FormatException {
|
||||
if (accept) {
|
||||
introductionManager.acceptIntroduction(contactId, sessionId, time);
|
||||
} else {
|
||||
introductionManager.declineIntroduction(contactId, sessionId, time);
|
||||
boolean accept, long time) throws DbException {
|
||||
try {
|
||||
introductionManager
|
||||
.respondToIntroduction(contactId, sessionId, time, accept);
|
||||
} catch (ProtocolStateException e) {
|
||||
if (LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
introductionResponseError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user