Relax assertion on httpclient abort

It's ok to still have transfers, as long as whatever transfers still exists
are in an aborted state.
This commit is contained in:
Karl Seguin
2026-04-02 17:59:17 +08:00
parent 38fa9602fa
commit de0a04a58e

View File

@@ -235,10 +235,6 @@ fn _abort(self: *Client, comptime abort_all: bool, frame_id: u32) void {
} }
} }
if (comptime IS_DEBUG and abort_all) {
std.debug.assert(self.active == 0);
}
{ {
var q = &self.queue; var q = &self.queue;
var n = q.first; var n = q.first;
@@ -259,12 +255,16 @@ fn _abort(self: *Client, comptime abort_all: bool, frame_id: u32) void {
} }
if (comptime IS_DEBUG and abort_all) { if (comptime IS_DEBUG and abort_all) {
std.debug.assert(self.in_use.first == null); // Even after an abort_all, we could still have transfers, but, at the
// very least, they should all be flagged as aborted.
const running = self.handles.perform() catch |err| { var it = self.in_use.first;
lp.assert(false, "multi perform in abort", .{ .err = err }); var leftover: usize = 0;
}; while (it) |node| : (it = node.next) {
std.debug.assert(running == 0); const conn: *http.Connection = @fieldParentPtr("node", node);
std.debug.assert((Transfer.fromConnection(conn) catch unreachable).aborted);
leftover += 1;
}
std.debug.assert(self.active == leftover);
} }
} }