mirror of
https://git.robbyzambito.me/zaprus
synced 2025-12-20 08:14:50 +00:00
Need to flush io in release mode
This commit is contained in:
@@ -48,6 +48,8 @@ pub fn main() !void {
|
||||
return clap.help(std.io.getStdErr().writer(), clap.Help, ¶ms, .{});
|
||||
}
|
||||
|
||||
std.debug.print("main\n", .{});
|
||||
|
||||
if (res.args.relay) |r| {
|
||||
try Saprus.sendRelay(if (r.len > 0) r else "Hello darkness my old friend", gpa);
|
||||
std.debug.print("Sent: {s}\n", .{r});
|
||||
|
||||
@@ -85,9 +85,11 @@ pub fn connect(payload: []const u8, allocator: Allocator) !?SaprusMessage {
|
||||
var initial_conn_res: ?SaprusMessage = null;
|
||||
errdefer if (initial_conn_res) |c| c.deinit(allocator);
|
||||
|
||||
std.debug.print("creating socket\n", .{});
|
||||
var sock = try network.Socket.create(.ipv4, .udp);
|
||||
defer sock.close();
|
||||
|
||||
std.debug.print("creating endpoint\n", .{});
|
||||
// Bind to 255.255.255.255:8888
|
||||
const bind_addr = network.EndPoint{
|
||||
.address = network.Address{ .ipv4 = network.Address.IPv4.broadcast },
|
||||
@@ -96,8 +98,10 @@ pub fn connect(payload: []const u8, allocator: Allocator) !?SaprusMessage {
|
||||
|
||||
// timeout 1s
|
||||
try sock.setReadTimeout(1 * std.time.us_per_s);
|
||||
std.debug.print("binding to socket\n", .{});
|
||||
try sock.bind(bind_addr);
|
||||
|
||||
std.debug.print("sending initial connection payload\n", .{});
|
||||
const msg = try sendInitialConnection(payload, initial_port, allocator);
|
||||
|
||||
var response_buf: [4096]u8 = undefined;
|
||||
|
||||
Reference in New Issue
Block a user