File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -114,15 +114,15 @@ pub const CDP = struct {
114114 self .session = try self .browser .newSession (self );
115115 }
116116
117- pub fn processMessage (self : * CDP , msg : []const u8 ) void {
117+ pub fn processMessage (self : * CDP , msg : []const u8 ) bool {
118118 const arena = & self .message_arena ;
119119 defer _ = arena .reset (.{ .retain_with_limit = 1024 * 16 });
120120
121121 self .dispatch (arena .allocator (), self , msg ) catch | err | {
122122 log .err ("failed to process message: {}\n {s}" , .{ err , msg });
123- self .client .close (null );
124- return ;
123+ return false ;
125124 };
125+ return true ;
126126 }
127127
128128 // Called from above, in processMessage which handles client messages
Original file line number Diff line number Diff line change @@ -555,6 +555,7 @@ fn ClientT(comptime S: type, comptime C: type) type {
555555 errdefer self .server .queueClose (self .socket );
556556
557557 var reader = & self .reader ;
558+
558559 while (true ) {
559560 const msg = reader .next () catch | err | {
560561 switch (err ) {
@@ -578,7 +579,10 @@ fn ClientT(comptime S: type, comptime C: type) type {
578579 self .server .queueClose (self .socket );
579580 return false ;
580581 },
581- .text , .binary = > self .cdp .? .processMessage (msg .data ),
582+ .text , .binary = > if (self .cdp .? .processMessage (msg .data ) == false ) {
583+ self .close (null );
584+ return false ;
585+ },
582586 }
583587 if (msg .cleanup_fragment ) {
584588 reader .cleanup ();
You can’t perform that action at this time.
0 commit comments