On CDP process error, let client decide how to close

Fixes issue where CDP closes the client, but client still registers a recv
operation.
This commit is contained in:
Karl Seguin
2025-02-17 12:05:25 +08:00
parent b60a91f53c
commit c4eeef2a86
2 changed files with 8 additions and 4 deletions

View File

@@ -555,6 +555,7 @@ fn ClientT(comptime S: type, comptime C: type) type {
errdefer self.server.queueClose(self.socket);
var reader = &self.reader;
while (true) {
const msg = reader.next() catch |err| {
switch (err) {
@@ -578,7 +579,10 @@ fn ClientT(comptime S: type, comptime C: type) type {
self.server.queueClose(self.socket);
return false;
},
.text, .binary => self.cdp.?.processMessage(msg.data),
.text, .binary => if (self.cdp.?.processMessage(msg.data) == false) {
self.close(null);
return false;
},
}
if (msg.cleanup_fragment) {
reader.cleanup();