Skip to content

Commit a43a6a2

Browse files
committed
Merge branch 'main' into cdp_struct
2 parents 1846d0b + d8fae5b commit a43a6a2

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/server.zig

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const AcceptError = jsruntime.IO.AcceptError;
3131
const RecvError = jsruntime.IO.RecvError;
3232
const SendError = jsruntime.IO.SendError;
3333
const CloseError = jsruntime.IO.CloseError;
34-
const CancelError = jsruntime.IO.CancelError;
34+
const CancelError = jsruntime.IO.CancelOneError;
3535
const TimeoutError = jsruntime.IO.TimeoutError;
3636

3737
const CDP = @import("cdp/cdp.zig").CDP;
@@ -47,6 +47,7 @@ const MAX_HTTP_REQUEST_SIZE = 2048;
4747
// +140 for the max control packet that might be interleaved in a message
4848
const MAX_MESSAGE_SIZE = 256 * 1024 + 14;
4949

50+
5051
pub const Client = ClientT(*Server, CDP);
5152

5253
const Server = struct {
@@ -242,8 +243,7 @@ const Server = struct {
242243
// (with its own completion), allocated on the heap.
243244
// After the send (on the sendCbk) the dedicated context will be destroy
244245
// and the data slice will be free.
245-
const Send = struct {
246-
// Any unsent data we have.
246+
const Send = struct { // Any unsent data we have.
247247
unsent: []const u8,
248248

249249
server: *Server,
@@ -307,7 +307,6 @@ fn ClientT(comptime S: type, comptime C: type) type {
307307
const CLOSE_NORMAL = [_]u8{ 136, 2, 3, 232 }; // code: 1000
308308
const CLOSE_TOO_BIG = [_]u8{ 136, 2, 3, 241 }; // 1009
309309
const CLOSE_PROTOCOL_ERROR = [_]u8{ 136, 2, 3, 234 }; //code: 1002
310-
311310
// "private-use" close codes must be from 4000-49999
312311
const CLOSE_TIMEOUT = [_]u8{ 136, 2, 15, 160 }; // code: 4000
313312

@@ -521,8 +520,8 @@ fn ClientT(comptime S: type, comptime C: type) type {
521520

522521
// The response will be sent via the IO Loop and thus has to have its
523522
// own lifetime.
524-
525523
const res = try arena.allocator().dupe(u8, template);
524+
526525
// magic response
527526
const key_pos = res.len - 32;
528527
var h: [20]u8 = undefined;
@@ -1223,6 +1222,7 @@ test "Client: write websocket message" {
12231222
.{ .expected = &.{ 129, 2, '"', '"' }, .message = "" },
12241223
.{ .expected = [_]u8{ 129, 14 } ++ "\"hello world!\"", .message = "hello world!" },
12251224
.{ .expected = [_]u8{ 129, 126, 0, 132 } ++ "\"" ++ ("A" ** 130) ++ "\"", .message = "A" ** 130 },
1225+
12261226
};
12271227

12281228
for (cases) |c| {
@@ -1233,7 +1233,6 @@ test "Client: write websocket message" {
12331233
defer client.deinit();
12341234

12351235
try client.sendJSON(c.message, .{});
1236-
12371236
try testing.expectEqual(1, ms.sent.items.len);
12381237
try testing.expectEqualSlices(u8, c.expected, ms.sent.items[0]);
12391238
}

src/unit_tests.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,5 +341,6 @@ test {
341341
std.testing.refAllDecls(@import("generate.zig"));
342342
std.testing.refAllDecls(@import("http/Client.zig"));
343343
std.testing.refAllDecls(@import("storage/storage.zig"));
344+
std.testing.refAllDecls(@import("iterator/iterator.zig"));
344345
std.testing.refAllDecls(@import("server.zig"));
345346
}

0 commit comments

Comments
 (0)