mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
tcp: forgot to deinit stuff
This commit is contained in:
@ -67,10 +67,12 @@ pub fn init(
|
|||||||
/// Deinitializes the server
|
/// Deinitializes the server
|
||||||
pub fn deinit(self: *Server) void {
|
pub fn deinit(self: *Server) void {
|
||||||
self.close();
|
self.close();
|
||||||
|
log.info("closing server socket", .{});
|
||||||
|
log.info("deinitializing server", .{});
|
||||||
|
self.loop.deinit();
|
||||||
self.comp_pool.deinit();
|
self.comp_pool.deinit();
|
||||||
self.sock_pool.deinit();
|
self.sock_pool.deinit();
|
||||||
self.buf_pool.deinit();
|
self.buf_pool.deinit();
|
||||||
self.loop.deinit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts the timer which tries to accept connections
|
/// Starts the timer which tries to accept connections
|
||||||
@ -81,16 +83,13 @@ pub fn start(self: *Server) !void {
|
|||||||
try connections.startAccepting(self);
|
try connections.startAccepting(self);
|
||||||
log.info("bound server to socket={any}", .{self.socket});
|
log.info("bound server to socket={any}", .{self.socket});
|
||||||
|
|
||||||
// TODO: Stop flag? Only necessary if we support signaling the server
|
// TODO(tale): Stop flag? Only necessary if we support signaling the server
|
||||||
// from the main thread on an event, ie. configuration reloading.
|
// from the main thread on an event, ie. configuration reloading.
|
||||||
while (true) {
|
try self.loop.run(.until_done);
|
||||||
try self.loop.run(.until_done);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Closes the server socket
|
/// Closes the server socket
|
||||||
pub fn close(self: *Server) void {
|
pub fn close(self: *Server) void {
|
||||||
log.info("closing server socket", .{});
|
|
||||||
var c: xev.Completion = undefined;
|
var c: xev.Completion = undefined;
|
||||||
self.socket.close(&self.loop, &c, bool, null, (struct {
|
self.socket.close(&self.loop, &c, bool, null, (struct {
|
||||||
fn callback(
|
fn callback(
|
||||||
|
@ -20,7 +20,9 @@ server: ?Server,
|
|||||||
/// up all the internal state necessary prior to starting the thread. It
|
/// up all the internal state necessary prior to starting the thread. It
|
||||||
/// is up to the caller to start the thread with the threadMain entrypoint.
|
/// is up to the caller to start the thread with the threadMain entrypoint.
|
||||||
pub fn init(alloc: Allocator, mailbox: *App.Mailbox.Queue) !Thread {
|
pub fn init(alloc: Allocator, mailbox: *App.Mailbox.Queue) !Thread {
|
||||||
const config = try Config.load(alloc);
|
var config = try Config.load(alloc);
|
||||||
|
defer config.deinit();
|
||||||
|
|
||||||
const max_clients = config.@"remote-max-connections";
|
const max_clients = config.@"remote-max-connections";
|
||||||
const addr = config.@"remote-tcp-socket";
|
const addr = config.@"remote-tcp-socket";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user