Add a way to print sent messages (in comments).

This commit is contained in:
Philippe Pittoli 2023-05-27 04:30:20 +02:00
parent a43c8bd6d3
commit efd7584ce5

View File

@ -1,10 +1,13 @@
const std = @import("std"); const std = @import("std");
const testing = std.testing; const testing = std.testing;
// const DEBUG = @import("./hexdump.zig");
const net = std.net; const net = std.net;
const os = std.os; const os = std.os;
const fmt = std.fmt; const fmt = std.fmt;
const c = std.c; const c = std.c;
// const print = std.debug.print;
// TODO: to remove once PR https://github.com/ziglang/zig/pull/14639 is accepted. // TODO: to remove once PR https://github.com/ziglang/zig/pull/14639 is accepted.
pub extern "c" fn umask(mode: c.mode_t) c.mode_t; pub extern "c" fn umask(mode: c.mode_t) c.mode_t;
@ -285,6 +288,12 @@ pub const Context = struct {
_ = try m.write(writer); // returns paylen _ = try m.write(writer); // returns paylen
_ = try stream.write(fbs.getWritten()); _ = try stream.write(fbs.getWritten());
// var hexbuf: [2000]u8 = undefined;
// var hexfbs = std.io.fixedBufferStream(&hexbuf);
// var hexwriter = hexfbs.writer();
// try DEBUG.hexdump(hexwriter, "MSG SENT", fbs.getWritten());
// print("{s}\n", .{hexfbs.getWritten()});
} }
pub fn schedule(self: *Self, m: Message) !void { pub fn schedule(self: *Self, m: Message) !void {