mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
refactor to remove duplicate endTransfer
This commit is contained in:
@@ -580,21 +580,28 @@ fn processMessages(self: *Client) !bool {
|
|||||||
log.debug(.http, "wait for auth interception", .{ .intercepted = self.intercepted });
|
log.debug(.http, "wait for auth interception", .{ .intercepted = self.intercepted });
|
||||||
}
|
}
|
||||||
transfer._intercept_state = .pending;
|
transfer._intercept_state = .pending;
|
||||||
|
|
||||||
|
// Wether or not this is a blocking request, we're not going
|
||||||
|
// to process it now. We can end the transfer, which will
|
||||||
|
// release the easy handle back into the pool. The transfer
|
||||||
|
// is still valid/alive (just has no handle).
|
||||||
|
self.endTransfer(transfer);
|
||||||
if (!transfer.req.blocking) {
|
if (!transfer.req.blocking) {
|
||||||
// the request is put on hold to be intercepted.
|
// In the case of an async request, we can just "forget"
|
||||||
// In this case we ignore callbacks for now.
|
// about this transfer until it gets updated asynchronously
|
||||||
// Note: we don't deinit transfer on purpose: we want to keep
|
// from some CDP command.
|
||||||
// using it for the following request
|
|
||||||
self.endTransfer(transfer);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.endTransfer(transfer);
|
// In the case of a sync request, we need to block until we
|
||||||
|
// get the CDP command for handling this case.
|
||||||
if (try self.waitForInterceptedResponse(transfer)) {
|
if (try self.waitForInterceptedResponse(transfer)) {
|
||||||
// we've been asked to continue with the request
|
// we've been asked to continue with the request
|
||||||
// we can't process it here, since we're already inside
|
// we can't process it here, since we're already inside
|
||||||
// a process, so we need to queue it and wait for the
|
// a process, so we need to queue it and wait for the
|
||||||
// next tick.
|
// next tick (this is why it was safe to endTransfer
|
||||||
|
// above, because even in the "blocking" path, we still
|
||||||
|
// only process it on the next tick).
|
||||||
self.queue.append(&transfer._node);
|
self.queue.append(&transfer._node);
|
||||||
} else {
|
} else {
|
||||||
// aborted, already cleaned up
|
// aborted, already cleaned up
|
||||||
|
|||||||
Reference in New Issue
Block a user