diff --git a/common/protocol_version.h b/common/protocol_version.h index a6740d40..fb65db1e 100644 --- a/common/protocol_version.h +++ b/common/protocol_version.h @@ -6,5 +6,5 @@ namespace wivrn { using protocol = std::variant; -static inline const constinit auto protocol_version = serialization_type_hash(); +static inline const constinit auto protocol_version = serialization_type_hash(protocol_revision); } // namespace wivrn diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index ef7ea644..10946552 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -38,6 +38,8 @@ namespace wivrn // Default port for server to listen, both TCP and UDP static const int default_port = 9757; +static constexpr int protocol_revision = 0; + enum class device_id : uint8_t { HEAD, // /user/head diff --git a/common/wivrn_serialization.h b/common/wivrn_serialization.h index 59debe24..e1cb2459 100644 --- a/common/wivrn_serialization.h +++ b/common/wivrn_serialization.h @@ -882,10 +882,14 @@ struct serialization_traits }; template -constexpr uint64_t serialization_type_hash() +constexpr uint64_t serialization_type_hash(int revision) { details::hash_context h; serialization_traits::type_hash(h); + + if (revision) + h.feed(revision); + return h.hash; }