Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/std/Build/Fuzz.zig
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub fn sendUpdate(
@ptrCast(coverage_map.source_locations),
coverage_map.coverage.string_bytes.items,
};
try socket.writeMessageVec(&iovecs, .binary);
try socket.writeFrameVec(&iovecs, .binary);
}

const header: abi.CoverageUpdateHeader = .{
Expand All @@ -281,7 +281,7 @@ pub fn sendUpdate(
@ptrCast(&header),
@ptrCast(seen_pcs),
};
try socket.writeMessageVec(&iovecs, .binary);
try socket.writeFrameVec(&iovecs, .binary);

prev.unique_runs = unique_runs;
}
Expand All @@ -292,7 +292,7 @@ pub fn sendUpdate(
@ptrCast(&header),
@ptrCast(coverage_map.entry_points.items),
};
try socket.writeMessageVec(&iovecs, .binary);
try socket.writeFrameVec(&iovecs, .binary);

prev.entry_points = coverage_map.entry_points.items.len;
}
Expand Down
14 changes: 8 additions & 6 deletions lib/std/Build/WebServer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ fn accept(ws: *WebServer, connection: std.net.Server.Connection) void {
switch (request.upgradeRequested()) {
.websocket => |opt_key| {
const key = opt_key orelse return log.err("missing websocket key", .{});
var web_socket = request.respondWebSocket(.{ .key = key }) catch {
var web_socket = request.respondWebSocket(.{ .key = key, .allocator = ws.gpa }) catch {
return log.err("failed to respond web socket: {t}", .{connection_writer.err.?});
};
defer web_socket.close(.{ .exit_code = 0 });
ws.serveWebSocket(&web_socket) catch |err| {
log.err("failed to serve websocket: {t}", .{err});
return;
Expand Down Expand Up @@ -298,7 +299,7 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn {
.steps_len = @intCast(ws.all_steps.len),
};
var bufs: [3][]const u8 = .{ @ptrCast(&hello_header), ws.step_names_trailing, prev_step_status_bits };
try sock.writeMessageVec(&bufs, .binary);
try sock.writeFrameVec(&bufs, .binary);
}

var prev_fuzz: Fuzz.Previous = .init;
Expand All @@ -323,7 +324,8 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn {
// Temporarily unlock, then re-lock after the message is sent.
ws.time_report_mutex.unlock();
defer ws.time_report_mutex.lock();
try sock.writeMessage(owned_msg, .binary);

try sock.writeFrame(owned_msg, .binary);
}
}

Expand All @@ -332,7 +334,7 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn {
if (build_status != prev_build_status) {
prev_build_status = build_status;
const msg: abi.StatusUpdate = .{ .new = build_status };
try sock.writeMessage(@ptrCast(&msg), .binary);
try sock.writeFrame(@ptrCast(&msg), .binary);
}
}

Expand All @@ -353,7 +355,7 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn {
};
for (cur, prev, byte_idx * 4..) |cur_status, prev_status, step_idx| {
const msg: abi.StepUpdate = .{ .step_idx = @intCast(step_idx), .bits = .{ .status = cur_status } };
if (cur_status != prev_status) try sock.writeMessage(@ptrCast(&msg), .binary);
if (cur_status != prev_status) try sock.writeFrame(@ptrCast(&msg), .binary);
}
prev_byte.* = cur_byte;
}
Expand All @@ -364,7 +366,7 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn {
}
fn recvWebSocketMessages(ws: *WebServer, sock: *http.Server.WebSocket) void {
while (true) {
const msg = sock.readSmallMessage() catch return;
const msg = sock.readMessage() catch return;
if (msg.opcode != .binary) continue;
if (msg.data.len == 0) continue;
const tag: abi.ToServerTag = @enumFromInt(msg.data[0]);
Expand Down
Loading