diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 84dfe2a..cb9002e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -128,18 +128,28 @@ void createIdentity(const vector<string> & args) } } -void printAttachResult(string prefix, Peer peer, future<bool> && success) +void printPairingResult(string prefix, Peer peer, future<PairingServiceBase::Outcome> && future) { + auto outcome = future.get(); ostringstream ss; ss << prefix << - (success.get() ? "-done " : "-failed ") << + (outcome == PairingServiceBase::Outcome::Success ? "-done " : "-failed ") << getPeer(peer).id; + switch (outcome) + { + case PairingServiceBase::Outcome::Success: break; + case PairingServiceBase::Outcome::PeerRejected: ss << " rejected"; break; + case PairingServiceBase::Outcome::UserRejected: ss << " user"; break; + case PairingServiceBase::Outcome::UnexpectedMessage: ss << " unexpected"; break; + case PairingServiceBase::Outcome::NonceMismatch: ss << " nonce"; break; + case PairingServiceBase::Outcome::Stale: ss << " stale"; break; + } printLine(ss.str()); } -future<bool> confirmPairing(string prefix, const Peer & peer, string confirm, future<bool> && success) +future<bool> confirmPairing(string prefix, const Peer & peer, string confirm, future<PairingServiceBase::Outcome> && outcome) { - thread(printAttachResult, prefix, peer, move(success)).detach(); + thread(printPairingResult, prefix, peer, move(outcome)).detach(); promise<bool> promise; auto input = promise.get_future(); |