diff --git a/server/driver/wivrn_connection.cpp b/server/driver/wivrn_connection.cpp index ab59e059..b13b178c 100644 --- a/server/driver/wivrn_connection.cpp +++ b/server/driver/wivrn_connection.cpp @@ -51,6 +51,9 @@ static std::string clean_key(std::string key) return key; } +wivrn::incorrect_pin::incorrect_pin() : + std::runtime_error("Incorrect PIN") {} + wivrn::wivrn_connection::wivrn_connection(std::stop_token stop_token, encryption_state state, std::string pin, TCP && tcp) : control(std::move(tcp)), stream(-1), @@ -217,7 +220,7 @@ void wivrn::wivrn_connection::init(std::stop_token stop_token, std::function(stop_token, enc_state, pin, std::move(tcp)); g_main_context_invoke(nullptr, &headset_connected_success, nullptr); } + catch (wivrn::incorrect_pin &) + { + std::cerr << "Incorrect PIN" << std::endl; + g_main_context_invoke(nullptr, &headset_connected_incorrect_pin, nullptr); + } catch (std::exception & e) { std::cerr << "Client connection failed: " << e.what() << std::endl;