Skip to content

Commit

Permalink
fix thi
Browse files Browse the repository at this point in the history
  • Loading branch information
cirospaciari committed Nov 26, 2024
1 parent 9f42b66 commit be513e9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bun.js/webcore/response.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1785,12 +1785,13 @@ pub const Fetch = struct {
}

pub fn callback(task: *FetchTasklet, async_http: *http.AsyncHTTP, result: http.HTTPClientResult) void {
task.mutex.lock();
defer task.mutex.unlock();
const is_done = !result.has_more;
// we are done with the http client so we can deref our side
defer if (is_done) task.deref();

task.mutex.lock();
// we need to unlock before task.deref();
defer task.mutex.unlock();
task.http.?.* = async_http.*;
task.http.?.response_buffer = async_http.response_buffer;

Expand Down

0 comments on commit be513e9

Please sign in to comment.