mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 06:23:45 +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 });
|
||||
}
|
||||
transfer._intercept_state = .pending;
|
||||
if (!transfer.req.blocking) {
|
||||
// the request is put on hold to be intercepted.
|
||||
// In this case we ignore callbacks for now.
|
||||
// Note: we don't deinit transfer on purpose: we want to keep
|
||||
// using it for the following request
|
||||
|
||||
// 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) {
|
||||
// In the case of an async request, we can just "forget"
|
||||
// about this transfer until it gets updated asynchronously
|
||||
// from some CDP command.
|
||||
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)) {
|
||||
// we've been asked to continue with the request
|
||||
// we can't process it here, since we're already inside
|
||||
// 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);
|
||||
} else {
|
||||
// aborted, already cleaned up
|
||||
|
||||
Reference in New Issue
Block a user