From 9fc26405bb0af6ef67c76417e887484d8791a874 Mon Sep 17 00:00:00 2001 From: wish Date: Tue, 18 Oct 2022 12:03:12 +1100 Subject: [PATCH] defer closing entranceserver connections --- server/entranceserver/entrance_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/entranceserver/entrance_server.go b/server/entranceserver/entrance_server.go index 56f300c27..706aac8b3 100644 --- a/server/entranceserver/entrance_server.go +++ b/server/entranceserver/entrance_server.go @@ -90,6 +90,7 @@ func (s *Server) acceptClients() { } func (s *Server) handleEntranceServerConnection(conn net.Conn) { + defer conn.Close() // Client initalizes the connection with a one-time buffer of 8 NULL bytes. nullInit := make([]byte, 8) n, err := io.ReadFull(conn, nullInit) @@ -118,5 +119,4 @@ func (s *Server) handleEntranceServerConnection(conn net.Conn) { cc.SendPacket(data) // Close because we only need to send the response once. // Any further requests from the client will come from a new connection. - conn.Close() }