Skip to content

Commit

Permalink
chore: close sockets asap
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpig committed Dec 22, 2024
1 parent 0190876 commit 26fe386
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions container/container_reexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion container/container_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 26fe386

Please sign in to comment.