fix: return error if a global's version is outdated

dev
LeRoyce Pearson 2024-01-16 01:22:42 -07:00
parent 1d5a5b3265
commit b46131a80a
1 changed files with 4 additions and 0 deletions

View File

@ -416,6 +416,10 @@ pub fn registerGlobals(alloc: std.mem.Allocator, id_pool: *IdPool, socket: std.n
.global => |global| { .global => |global| {
var buffer: [20]u32 = undefined; var buffer: [20]u32 = undefined;
if (map.get(global.interface)) |item| { if (map.get(global.interface)) |item| {
if (global.version < item.version) {
// TODO: Add diagnostics API
return error.OutdatedCompositorProtocol;
}
const new_id = id_pool.create(); const new_id = id_pool.create();
ids[item.index] = new_id; ids[item.index] = new_id;
const message = try serialize(core.Registry.Request, &buffer, registry_id, .{ .bind = .{ const message = try serialize(core.Registry.Request, &buffer, registry_id, .{ .bind = .{