mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
don't try (and fail) to get userData after clearing context
This commit is contained in:
@@ -73,54 +73,55 @@ pub const LightPanda = struct {
|
||||
);
|
||||
}
|
||||
|
||||
fn handleError(self: *LightPanda, ctx: *Client.Ctx, err: anyerror) anyerror!void {
|
||||
ctx.deinit();
|
||||
self.client_context_pool.destroy(ctx);
|
||||
fn handleError(sending: *Sending, ctx: *Client.Ctx, err: anyerror) anyerror!void {
|
||||
const lightpanda = sending.lightpanda;
|
||||
|
||||
ctx.deinit();
|
||||
lightpanda.client_context_pool.destroy(ctx);
|
||||
|
||||
var sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
sending.deinit();
|
||||
self.sending_pool.destroy(sending);
|
||||
lightpanda.sending_pool.destroy(sending);
|
||||
log.info("request failure: {}", .{err});
|
||||
}
|
||||
|
||||
fn onRequestConnect(ctx: *Client.Ctx, res: anyerror!void) anyerror!void {
|
||||
var sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return sending.lightpanda.handleError(ctx, err);
|
||||
const sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return handleError(sending, ctx, err);
|
||||
|
||||
ctx.req.transfer_encoding = .{ .content_length = sending.body.len };
|
||||
return ctx.req.async_send(ctx, onRequestSend) catch |err| {
|
||||
return sending.lightpanda.handleError(ctx, err);
|
||||
return handleError(sending, ctx, err);
|
||||
};
|
||||
}
|
||||
|
||||
fn onRequestSend(ctx: *Client.Ctx, res: anyerror!void) anyerror!void {
|
||||
var sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return sending.lightpanda.handleError(ctx, err);
|
||||
const sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return handleError(sending, ctx, err);
|
||||
|
||||
return ctx.req.async_writeAll(sending.body, ctx, onRequestWrite) catch |err| {
|
||||
return sending.lightpanda.handleError(ctx, err);
|
||||
return handleError(sending, ctx, err);
|
||||
};
|
||||
}
|
||||
|
||||
fn onRequestWrite(ctx: *Client.Ctx, res: anyerror!void) anyerror!void {
|
||||
var sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return sending.lightpanda.handleError(ctx, err);
|
||||
const sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return handleError(sending, ctx, err);
|
||||
return ctx.req.async_finish(ctx, onRequestFinish) catch |err| {
|
||||
return sending.lightpanda.handleError(ctx, err);
|
||||
return handleError(sending, ctx, err);
|
||||
};
|
||||
}
|
||||
|
||||
fn onRequestFinish(ctx: *Client.Ctx, res: anyerror!void) anyerror!void {
|
||||
var sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return sending.lightpanda.handleError(ctx, err);
|
||||
const sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return handleError(sending, ctx, err);
|
||||
return ctx.req.async_wait(ctx, onRequestWait) catch |err| {
|
||||
return sending.lightpanda.handleError(ctx, err);
|
||||
return handleError(sending, ctx, err);
|
||||
};
|
||||
}
|
||||
|
||||
fn onRequestWait(ctx: *Client.Ctx, res: anyerror!void) anyerror!void {
|
||||
var sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return sending.lightpanda.handleError(ctx, err);
|
||||
const sending: *Sending = @ptrCast(@alignCast(ctx.userData));
|
||||
res catch |err| return handleError(sending, ctx, err);
|
||||
|
||||
const lightpanda = sending.lightpanda;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const log = std.log.scoped(.telemetry);
|
||||
const ID_FILE = "lightpanda.id";
|
||||
|
||||
pub const Telemetry = TelemetryT(blk: {
|
||||
if (builtin.mode == .Debug or builtin.is_test) break :blk NoopProvider;
|
||||
// if (builtin.mode == .Debug or builtin.is_test) break :blk NoopProvider;
|
||||
break :blk @import("lightpanda.zig").LightPanda;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user