Skip to content

Commit

Permalink
lib: ci skip: consistent var name
Browse files Browse the repository at this point in the history
  • Loading branch information
flowerinthenight committed Sep 23, 2024
1 parent da3bb81 commit 29d6a84
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/main.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const std = @import("std");
const backoff = @import("zbackoff");
const zgroup = @import("zgroup.zig");
const backoff = @import("zbackoff");

const log = std.log;

Expand Down Expand Up @@ -154,6 +154,7 @@ pub fn main() !void {
}

// We are using curl here as std.http.Client seems to not play well with this endpoint.
// The "seegmed7" in the url is our API key.
fn setJoinAddress(allocator: std.mem.Allocator, group: []const u8, addr: []const u8) !void {
const enc = std.base64.Base64Encoder.init(std.base64.url_safe_alphabet_chars, '=');
const buf = try allocator.alloc(u8, enc.calcSize(addr.len));
Expand Down
30 changes: 15 additions & 15 deletions src/zgroup.zig
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ pub fn Fleet(UserData: type) type {
dst_port: u16,
joined: *bool,
) !void {
var parent = std.heap.ArenaAllocator.init(self.allocator);
defer parent.deinit(); // destroy arena in one go
const arena = parent.allocator();
var aa = std.heap.ArenaAllocator.init(self.allocator);
defer aa.deinit(); // destroy arena in one go
const arena = aa.allocator();

const buf = try arena.alloc(u8, @sizeOf(Message));
const msg: *Message = @ptrCast(@alignCast(buf));
Expand Down Expand Up @@ -356,9 +356,9 @@ pub fn Fleet(UserData: type) type {
continue;
};

var parent = std.heap.ArenaAllocator.init(self.allocator);
defer parent.deinit(); // destroy arena in one go
const arena = parent.allocator();
var aa = std.heap.ArenaAllocator.init(self.allocator);
defer aa.deinit(); // destroy arena in one go
const arena = aa.allocator();

switch (msg.isd_cmd) {
.infect,
Expand Down Expand Up @@ -546,9 +546,9 @@ pub fn Fleet(UserData: type) type {
fn tick(self: *Self) !void {
var i: usize = 0;
while (true) : (i += 1) {
var parent = std.heap.ArenaAllocator.init(self.allocator);
defer parent.deinit(); // destroy arena in one go
const arena = parent.allocator();
var aa = std.heap.ArenaAllocator.init(self.allocator);
defer aa.deinit(); // destroy arena in one go
const arena = aa.allocator();

log.debug("[{d}]", .{i}); // log separator

Expand Down Expand Up @@ -885,9 +885,9 @@ pub fn Fleet(UserData: type) type {
// eg. "127.0.0.1:8080". For pings, we use the src_* payload fields
// to identify us, the sender.
fn ping(self: *Self, key: []const u8) !bool {
var parent = std.heap.ArenaAllocator.init(self.allocator);
defer parent.deinit(); // destroy arena in one go
const arena = parent.allocator();
var aa = std.heap.ArenaAllocator.init(self.allocator);
defer aa.deinit(); // destroy arena in one go
const arena = aa.allocator();

const sep = std.mem.indexOf(u8, key, ":") orelse return false;
const ip = key[0..sep];
Expand Down Expand Up @@ -955,9 +955,9 @@ pub fn Fleet(UserData: type) type {
fn indirectPing(args: *IndirectPing) !void {
log.debug("[thread] try pinging {s} via {s}", .{ args.dst, args.src });

var parent = std.heap.ArenaAllocator.init(args.self.allocator);
defer parent.deinit(); // destroy arena in one go
const arena = parent.allocator();
var aa = std.heap.ArenaAllocator.init(args.self.allocator);
defer aa.deinit(); // destroy arena in one go
const arena = aa.allocator();

const sep = std.mem.indexOf(u8, args.src, ":") orelse return;
const ip = args.src[0..sep];
Expand Down

0 comments on commit 29d6a84

Please sign in to comment.