Skip to content

Commit

Permalink
refactor(shred_collector): rename service manager variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dnut committed May 31, 2024
1 parent 5df9128 commit 79c9b40
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/shred_collector/service.zig
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ pub fn start(
deps: ShredCollectorDependencies,
interface: ShredCollectorInterface,
) !ServiceManager {
var shred_collector = ServiceManager.init(deps.allocator, deps.logger, interface.exit);
var arena = shred_collector.arena();
var service_manager = ServiceManager.init(deps.allocator, deps.logger, interface.exit);
var arena = service_manager.arena();

const repair_socket = try bindUdpReusable(conf.repair_port);
const tvu_socket = try bindUdpReusable(conf.tvu_port);
Expand Down Expand Up @@ -94,7 +94,7 @@ pub fn start(
interface.exit,
);
const repair_svc = try arena.create(RepairService);
try shred_collector.defers.deferCall(RepairService.deinit, .{repair_svc});
try service_manager.defers.deferCall(RepairService.deinit, .{repair_svc});
repair_svc.* = RepairService.init(
deps.allocator,
deps.logger,
Expand All @@ -103,7 +103,7 @@ pub fn start(
repair_peer_provider,
shred_tracker,
);
try shred_collector.spawn(
try service_manager.spawn(
RepairService.run_config,
RepairService.sendNecessaryRepairs,
.{repair_svc},
Expand All @@ -129,23 +129,23 @@ pub fn start(
.outgoing_shred_channel = unverified_shreds_channel,
.shred_version = interface.my_shred_version,
};
try shred_collector.spawn(.{ .name = "Shred Receiver" }, ShredReceiver.run, .{shred_receiver});
try service_manager.spawn(.{ .name = "Shred Receiver" }, ShredReceiver.run, .{shred_receiver});

// verifier (thread)
try shred_collector.spawn(
try service_manager.spawn(
.{ .name = "Shred Verifier" },
sig.shred_collector.runShredSignatureVerification,
.{ interface.exit, unverified_shreds_channel, verified_shreds_channel, .{} },
);

// processor (thread)
try shred_collector.spawn(
try service_manager.spawn(
.{ .name = "Shred Processor" },
sig.shred_collector.processShreds,
.{ deps.allocator, verified_shreds_channel, shred_tracker },
);

return shred_collector;
return service_manager;
}

fn bindUdpReusable(port: u16) !Socket {
Expand Down

0 comments on commit 79c9b40

Please sign in to comment.