summaryrefslogtreecommitdiff
path: root/src/pairing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pairing.cpp')
-rw-r--r--src/pairing.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pairing.cpp b/src/pairing.cpp
index f25cb5c..c22a7af 100644
--- a/src/pairing.cpp
+++ b/src/pairing.cpp
@@ -147,7 +147,9 @@ void PairingServiceBase::handle(Context & ctx)
requestNonceFailedHook(ctx.peer());
if (state->phase < StatePhase::PairingDone) {
state->phase = StatePhase::PairingFailed;
- state->outcome.set_value(Outcome::NonceMismatch);
+ ctx.afterCommit([&]() {
+ state->outcome.set_value(Outcome::NonceMismatch);
+ });
}
return;
}
@@ -166,7 +168,9 @@ void PairingServiceBase::handle(Context & ctx)
else if (auto reject = rec->item("reject").asText()) {
if (state->phase < StatePhase::PairingDone) {
state->phase = StatePhase::PairingFailed;
- state->outcome.set_value(Outcome::PeerRejected);
+ ctx.afterCommit([&]() {
+ state->outcome.set_value(Outcome::PeerRejected);
+ });
}
}
@@ -174,7 +178,9 @@ void PairingServiceBase::handle(Context & ctx)
if (state->phase == StatePhase::OurRequestReady) {
handlePairingResult(ctx);
state->phase = StatePhase::PairingDone;
- state->outcome.set_value(Outcome::Success);
+ ctx.afterCommit([&]() {
+ state->outcome.set_value(Outcome::Success);
+ });
} else {
result = ctx.ref();
}