Check protocol compatibility on handshake
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "wivrn_client.h"
|
||||
#include "hardware.h"
|
||||
#include "protocol_version.h"
|
||||
#include "secrets.h"
|
||||
#include "smp.h"
|
||||
#include "spdlog/common.h"
|
||||
@@ -99,6 +100,7 @@ void wivrn_session::handshake(T address, bool tcp_only, crypto::key & headset_ke
|
||||
};
|
||||
|
||||
send_control(from_headset::crypto_handshake{
|
||||
.protocol_version = wivrn::protocol_version,
|
||||
.public_key = headset_keypair.public_key(),
|
||||
.name = model_name(),
|
||||
});
|
||||
@@ -178,6 +180,10 @@ void wivrn_session::handshake(T address, bool tcp_only, crypto::key & headset_ke
|
||||
case to_headset::crypto_handshake::crypto_state::pairing_disabled:
|
||||
spdlog::info("Pairing is disabled on server");
|
||||
throw std::runtime_error(_("Pairing is disabled on server"));
|
||||
|
||||
case to_headset::crypto_handshake::crypto_state::incompatible_version:
|
||||
spdlog::error("Incompatible protocol versions");
|
||||
throw std::runtime_error(_("Incompatible server version"));
|
||||
}
|
||||
|
||||
// may be on control socket if forced TCP
|
||||
|
||||
Reference in New Issue
Block a user