Add protocol revision number in protocol hash
This commit is contained in:
@@ -6,5 +6,5 @@
|
|||||||
namespace wivrn
|
namespace wivrn
|
||||||
{
|
{
|
||||||
using protocol = std::variant<from_headset::packets, to_headset::packets>;
|
using protocol = std::variant<from_headset::packets, to_headset::packets>;
|
||||||
static inline const constinit auto protocol_version = serialization_type_hash<protocol>();
|
static inline const constinit auto protocol_version = serialization_type_hash<protocol>(protocol_revision);
|
||||||
} // namespace wivrn
|
} // namespace wivrn
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ namespace wivrn
|
|||||||
// Default port for server to listen, both TCP and UDP
|
// Default port for server to listen, both TCP and UDP
|
||||||
static const int default_port = 9757;
|
static const int default_port = 9757;
|
||||||
|
|
||||||
|
static constexpr int protocol_revision = 0;
|
||||||
|
|
||||||
enum class device_id : uint8_t
|
enum class device_id : uint8_t
|
||||||
{
|
{
|
||||||
HEAD, // /user/head
|
HEAD, // /user/head
|
||||||
|
|||||||
@@ -882,10 +882,14 @@ struct serialization_traits<data_holder>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr uint64_t serialization_type_hash()
|
constexpr uint64_t serialization_type_hash(int revision)
|
||||||
{
|
{
|
||||||
details::hash_context h;
|
details::hash_context h;
|
||||||
serialization_traits<T>::type_hash(h);
|
serialization_traits<T>::type_hash(h);
|
||||||
|
|
||||||
|
if (revision)
|
||||||
|
h.feed(revision);
|
||||||
|
|
||||||
return h.hash;
|
return h.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user