@@ -69,7 +69,11 @@ pub const Ctx = struct {
6969 // callbacks
7070 // ---------
7171
72- fn acceptCbk (self : * Ctx , completion : * Completion , result : AcceptError ! std.posix.socket_t ) void {
72+ fn acceptCbk (
73+ self : * Ctx ,
74+ completion : * Completion ,
75+ result : AcceptError ! std.posix.socket_t ,
76+ ) void {
7377 std .debug .assert (completion == self .conn_completion );
7478
7579 self .conn_socket = result catch | err | {
@@ -82,10 +86,23 @@ pub const Ctx = struct {
8286 std .log .err ("accept timestamp error: {any}" , .{err });
8387 return ;
8488 };
85- self .loop .io .timeout (* Ctx , self , Ctx .timeoutCbk , self .timeout_completion , TimeoutCheck );
89+ self .loop .io .timeout (
90+ * Ctx ,
91+ self ,
92+ Ctx .timeoutCbk ,
93+ self .timeout_completion ,
94+ TimeoutCheck ,
95+ );
8696
8797 // receving incomming messages asynchronously
88- self .loop .io .recv (* Ctx , self , Ctx .readCbk , self .conn_completion , self .conn_socket , self .read_buf );
98+ self .loop .io .recv (
99+ * Ctx ,
100+ self ,
101+ Ctx .readCbk ,
102+ self .conn_completion ,
103+ self .conn_socket ,
104+ self .read_buf ,
105+ );
89106 }
90107
91108 fn readCbk (self : * Ctx , completion : * Completion , result : RecvError ! usize ) void {
@@ -98,7 +115,14 @@ pub const Ctx = struct {
98115
99116 if (size == 0 ) {
100117 // continue receving incomming messages asynchronously
101- self .loop .io .recv (* Ctx , self , Ctx .readCbk , self .conn_completion , self .conn_socket , self .read_buf );
118+ self .loop .io .recv (
119+ * Ctx ,
120+ self ,
121+ Ctx .readCbk ,
122+ self .conn_completion ,
123+ self .conn_socket ,
124+ self .read_buf ,
125+ );
102126 return ;
103127 }
104128
@@ -124,7 +148,14 @@ pub const Ctx = struct {
124148 };
125149
126150 // continue receving incomming messages asynchronously
127- self .loop .io .recv (* Ctx , self , Ctx .readCbk , self .conn_completion , self .conn_socket , self .read_buf );
151+ self .loop .io .recv (
152+ * Ctx ,
153+ self ,
154+ Ctx .readCbk ,
155+ self .conn_completion ,
156+ self .conn_socket ,
157+ self .read_buf ,
158+ );
128159 }
129160
130161 fn timeoutCbk (self : * Ctx , completion : * Completion , result : TimeoutError ! void ) void {
@@ -155,12 +186,24 @@ pub const Ctx = struct {
155186 // (and cancel does not work on MacOS)
156187
157188 // close current connection
158- self .loop .io .close (* Ctx , self , Ctx .closeCbk , self .timeout_completion , self .conn_socket );
189+ self .loop .io .close (
190+ * Ctx ,
191+ self ,
192+ Ctx .closeCbk ,
193+ self .timeout_completion ,
194+ self .conn_socket ,
195+ );
159196 return ;
160197 }
161198
162199 // continue checking timeout
163- self .loop .io .timeout (* Ctx , self , Ctx .timeoutCbk , self .timeout_completion , TimeoutCheck );
200+ self .loop .io .timeout (
201+ * Ctx ,
202+ self ,
203+ Ctx .timeoutCbk ,
204+ self .timeout_completion ,
205+ TimeoutCheck ,
206+ );
164207 }
165208
166209 fn closeCbk (self : * Ctx , completion : * Completion , result : CloseError ! void ) void {
@@ -187,7 +230,13 @@ pub const Ctx = struct {
187230 std .log .debug ("accepting new conn..." , .{});
188231
189232 // continue accepting incoming requests
190- self .loop .io .accept (* Ctx , self , Ctx .acceptCbk , self .conn_completion , self .accept_socket );
233+ self .loop .io .accept (
234+ * Ctx ,
235+ self ,
236+ Ctx .acceptCbk ,
237+ self .conn_completion ,
238+ self .accept_socket ,
239+ );
191240 }
192241
193242 // shortcuts
@@ -217,7 +266,13 @@ pub const Ctx = struct {
217266 if (std .mem .eql (u8 , cmd , "close" )) {
218267 // close connection
219268 std .log .debug ("close cmd, closing..." , .{});
220- self .loop .io .close (* Ctx , self , Ctx .closeCbk , self .conn_completion , self .conn_socket );
269+ self .loop .io .close (
270+ * Ctx ,
271+ self ,
272+ Ctx .closeCbk ,
273+ self .conn_completion ,
274+ self .conn_socket ,
275+ );
221276 return error .Closed ;
222277 }
223278
@@ -245,7 +300,11 @@ pub const Ctx = struct {
245300
246301 fn newSession (self : * Ctx ) ! void {
247302 try self .browser .newSession (self .alloc (), self .loop );
248- try self .browser .currentSession ().setInspector (self , Ctx .onInspectorResp , Ctx .onInspectorNotif );
303+ try self .browser .currentSession ().setInspector (
304+ self ,
305+ Ctx .onInspectorResp ,
306+ Ctx .onInspectorNotif ,
307+ );
249308 self .sessionNew = true ;
250309 std .log .debug ("new session" , .{});
251310 }
@@ -268,7 +327,11 @@ pub const Ctx = struct {
268327 // inject sessionID in cdp msg
269328 const tpl = "{s},\" sessionId\" :\" {s}\" }}" ;
270329 const msg_open = msg [0 .. msg .len - 1 ]; // remove closing bracket
271- const s = try std .fmt .allocPrint (allocator , tpl , .{ msg_open , cdp .ContextSessionID });
330+ const s = try std .fmt .allocPrint (
331+ allocator ,
332+ tpl ,
333+ .{ msg_open , cdp .ContextSessionID },
334+ );
272335 defer ctx .alloc ().free (s );
273336
274337 try sendSync (ctx , s );
@@ -363,7 +426,11 @@ pub fn listen(
363426 .conn_completion = & conn_completion ,
364427 .timeout_completion = & timeout_completion ,
365428 };
366- try browser .currentSession ().setInspector (& ctx , Ctx .onInspectorResp , Ctx .onInspectorNotif );
429+ try browser .currentSession ().setInspector (
430+ & ctx ,
431+ Ctx .onInspectorResp ,
432+ Ctx .onInspectorNotif ,
433+ );
367434
368435 // accepting connection asynchronously on internal server
369436 std .log .debug ("accepting new conn..." , .{});
0 commit comments