summaryrefslogtreecommitdiff
path: root/src/bin/main.zig
diff options
context:
space:
mode:
authorNic Gaffney <gaffney_nic@protonmail.com>2026-10-20 04:12:48 -0500
committerNic Gaffney <gaffney_nic@protonmail.com>2026-10-20 04:12:48 -0500
commit17ba6ecf840e743db2a2a305df73070d0eb69217 (patch)
treefdd7ec6e6716c64d7441ba6077848ef5ea45ddde /src/bin/main.zig
parentafac4c8c7780cc40bb41d8bae97a4ae83a79db9f (diff)
downloadnvlope-17ba6ecf840e743db2a2a305df73070d0eb69217.tar.gz
reorganized
Diffstat (limited to 'src/bin/main.zig')
-rw-r--r--src/bin/main.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bin/main.zig b/src/bin/main.zig
index 634676d..6784263 100644
--- a/src/bin/main.zig
+++ b/src/bin/main.zig
@@ -1,7 +1,6 @@
const std = @import("std");
const Io = std.Io;
-const Response = @import("response.zig");
-const App = Response.App;
+const App = @import("app.zig");
const nv = @import("nvlope");
@@ -10,7 +9,7 @@ pub fn main(init: std.process.Init) !void {
const alloc = std.heap.smp_allocator;
// Initialize server on localhost at the specified port
- const port = 8080;
+ const port = 2525;
const addr = try Io.net.IpAddress.parse("127.0.0.1", port);
var server = try addr.listen(io, .{
.mode = .stream,
@@ -22,8 +21,9 @@ pub fn main(init: std.process.Init) !void {
var group: Io.Group = .init;
defer group.cancel(io);
+ // Async delivery worker here
+
while (true) {
- std.debug.print("Waiting for conn...\n", .{});
const stream = try server.accept(io);
group.async(io, serve, .{ alloc, io, stream });
}
@@ -52,7 +52,7 @@ fn session(alloc: std.mem.Allocator, io: Io, stream: *Io.net.Stream) !void {
var app: App = .{ .gpa = alloc };
// Greeting: the server speaks first
- try nv.Reply.single(.ready, "localhost ESMTP ready").send(w);
+ try nv.Reply.single(.ready, "nvlope ready").send(w);
try w.flush();
var in_data = false;
@@ -74,6 +74,7 @@ fn session(alloc: std.mem.Allocator, io: Io, stream: *Io.net.Stream) !void {
in_data = false;
try nv.Reply.single(.ok, "Queued").send(w);
try w.flush();
+ std.debug.print("App {{\n\t body: {s}\n\tsender: {s}\n\trecipients: {any}\n}}\n", .{ app.body.items, app.sender.?, app.recipients.items });
} else {
const status = try app.appendBodyLine(line);
switch (status) {