@@ -73,54 +73,55 @@ pub const LightPanda = struct {
7373 );
7474 }
7575
76- fn handleError (self : * LightPanda , ctx : * Client.Ctx , err : anyerror ) anyerror ! void {
76+ fn handleError (sending : * Sending , ctx : * Client.Ctx , err : anyerror ) anyerror ! void {
77+ const lightpanda = sending .lightpanda ;
78+
7779 ctx .deinit ();
78- self .client_context_pool .destroy (ctx );
80+ lightpanda .client_context_pool .destroy (ctx );
7981
80- var sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
8182 sending .deinit ();
82- self .sending_pool .destroy (sending );
83+ lightpanda .sending_pool .destroy (sending );
8384 log .info ("request failure: {}" , .{err });
8485 }
8586
8687 fn onRequestConnect (ctx : * Client.Ctx , res : anyerror ! void ) anyerror ! void {
87- var sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
88- res catch | err | return sending . lightpanda . handleError (ctx , err );
88+ const sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
89+ res catch | err | return handleError (sending , ctx , err );
8990
9091 ctx .req .transfer_encoding = .{ .content_length = sending .body .len };
9192 return ctx .req .async_send (ctx , onRequestSend ) catch | err | {
92- return sending . lightpanda . handleError (ctx , err );
93+ return handleError (sending , ctx , err );
9394 };
9495 }
9596
9697 fn onRequestSend (ctx : * Client.Ctx , res : anyerror ! void ) anyerror ! void {
97- var sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
98- res catch | err | return sending . lightpanda . handleError (ctx , err );
98+ const sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
99+ res catch | err | return handleError (sending , ctx , err );
99100
100101 return ctx .req .async_writeAll (sending .body , ctx , onRequestWrite ) catch | err | {
101- return sending . lightpanda . handleError (ctx , err );
102+ return handleError (sending , ctx , err );
102103 };
103104 }
104105
105106 fn onRequestWrite (ctx : * Client.Ctx , res : anyerror ! void ) anyerror ! void {
106- var sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
107- res catch | err | return sending . lightpanda . handleError (ctx , err );
107+ const sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
108+ res catch | err | return handleError (sending , ctx , err );
108109 return ctx .req .async_finish (ctx , onRequestFinish ) catch | err | {
109- return sending . lightpanda . handleError (ctx , err );
110+ return handleError (sending , ctx , err );
110111 };
111112 }
112113
113114 fn onRequestFinish (ctx : * Client.Ctx , res : anyerror ! void ) anyerror ! void {
114- var sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
115- res catch | err | return sending . lightpanda . handleError (ctx , err );
115+ const sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
116+ res catch | err | return handleError (sending , ctx , err );
116117 return ctx .req .async_wait (ctx , onRequestWait ) catch | err | {
117- return sending . lightpanda . handleError (ctx , err );
118+ return handleError (sending , ctx , err );
118119 };
119120 }
120121
121122 fn onRequestWait (ctx : * Client.Ctx , res : anyerror ! void ) anyerror ! void {
122- var sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
123- res catch | err | return sending . lightpanda . handleError (ctx , err );
123+ const sending : * Sending = @ptrCast (@alignCast (ctx .userData ));
124+ res catch | err | return handleError (sending , ctx , err );
124125
125126 const lightpanda = sending .lightpanda ;
126127
0 commit comments