diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2022-12-17 20:10:20 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2022-12-17 20:10:20 +0100 |
commit | 77fc16d21158c6542addcbaaff47b801d3b5f5c7 (patch) | |
tree | 8154df1323fb1cfed40785ed13ecce745c64b5ea /src/pairing.cpp | |
parent | 50ee22fde82dc7429d983171935165866493c38e (diff) |
Confirm pairing outcome after head commit
Diffstat (limited to 'src/pairing.cpp')
-rw-r--r-- | src/pairing.cpp | 12 |
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(); } |