-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.zig
More file actions
27 lines (21 loc) · 836 Bytes
/
main.zig
File metadata and controls
27 lines (21 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const std = @import("std");
const TcpServer = @import("server/tcp.zig").TcpServer;
const types = @import("common/types.zig");
/// Entry point for the MQTT server
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
std.debug.print("ProtoMQ Server Starting...\n", .{});
std.debug.print("Version: 0.2.0\n", .{});
std.debug.print("Zig Version: {s}\n\n", .{@import("builtin").zig_version_string});
// Create and start TCP server
var server = try TcpServer.init(allocator, types.DEFAULT_HOST, types.DEFAULT_PORT);
defer server.deinit();
// Run the server (this blocks)
try server.run();
std.debug.print("\n✓ Server stopped cleanly\n", .{});
}
test "basic sanity test" {
try std.testing.expect(true);
}