Changes
1 changed files (+21/-5)
-
-
@@ -439,14 +439,21 @@ return .{.server = server.retain(), .host = host, .saved_token = saved_token, .browse_listeners = std.AutoHashMap(u64, BrowseListener).init(allocator), .load_listeners = std.AutoHashMap(u64, LoadListener).init(allocator), .image_downloads = std.AutoHashMap(u64, *ImageDownload).init(allocator), .control_events = std.AutoHashMap(u64, ControlListener).init(allocator), .browse_listeners = undefined, .load_listeners = undefined, .image_downloads = undefined, .control_events = undefined, }; } fn deinit(self: *Internal) void { fn initListeners(self: *Internal) void { self.browse_listeners = std.AutoHashMap(u64, BrowseListener).init(allocator); self.load_listeners = std.AutoHashMap(u64, LoadListener).init(allocator); self.image_downloads = std.AutoHashMap(u64, *ImageDownload).init(allocator); self.control_events = std.AutoHashMap(u64, ControlListener).init(allocator); } fn deinitListeners(self: *Internal) void { self.browse_listeners.deinit(); self.load_listeners.deinit();
-
@@ -456,6 +463,10 @@ download.*.deinit();} self.image_downloads.deinit(); self.control_events.deinit(); } fn deinit(self: *Internal) void { self.deinitListeners(); if (self.ws) |*ws| { ws.deinit();
-
@@ -544,6 +555,8 @@ std.posix.close(ws.stream.stream.handle);ws.deinit(); self.internal.ws = null; } self.internal.deinitListeners(); } pub fn getEvent(ptr: ?*Connection) callconv(.C) ?*Event {
-
@@ -748,6 +761,9 @@ std.log.debug("Establishing WebSocket connection to {}...", .{self.internal.server.internal.address}, ); self.internal.initListeners(); errdefer self.internal.deinitListeners(); var ws = try websocket.Client.init(allocator, .{ .host = self.internal.host,
-