From 26fe3864f7019f9124f06a6b5744f1ec40024313 Mon Sep 17 00:00:00 2001 From: nixpig <143995476+nixpig@users.noreply.github.com> Date: Sun, 22 Dec 2024 07:44:07 +0000 Subject: [PATCH] chore: close sockets asap --- container/container_reexec.go | 6 +++--- container/container_start.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/container/container_reexec.go b/container/container_reexec.go index d93c6d1..8bd166a 100644 --- a/container/container_reexec.go +++ b/container/container_reexec.go @@ -55,7 +55,7 @@ func (c *Container) Reexec() error { initConn.Write([]byte("ready")) // close asap so it doesn't leak into the container - defer initConn.Close() + initConn.Close() // wait for "start" if err := os.RemoveAll( @@ -89,8 +89,8 @@ func (c *Container) Reexec() error { } // close as soon as we're done so they don't leak into the container - defer containerConn.Close() - defer listener.Close() + containerConn.Close() + listener.Close() // after receiving "start" if c.Spec.Process == nil { diff --git a/container/container_start.go b/container/container_start.go index 4d3c59f..607dbd4 100644 --- a/container/container_start.go +++ b/container/container_start.go @@ -39,7 +39,7 @@ func (c *Container) Start() error { if _, err := conn.Write([]byte("start")); err != nil { return fmt.Errorf("send 'start' to container: %w", err) } - defer conn.Close() + conn.Close() c.SetStatus(specs.StateRunning) if err := c.Save(); err != nil {