diff --git a/fsd/client.go b/fsd/client.go index b3c8247..3441fe8 100644 --- a/fsd/client.go +++ b/fsd/client.go @@ -108,8 +108,6 @@ func (s *Server) eventLoop(client *Client) { go client.senderWorker() for { - // Set deadline and attempt to read - client.conn.SetReadDeadline(getTimeBySecondsInFuture(s.cfg.ConnectionTimeoutSeconds)) if !client.scanner.Scan() { return } diff --git a/fsd/conn.go b/fsd/conn.go index 4cb351e..41ae4d1 100644 --- a/fsd/conn.go +++ b/fsd/conn.go @@ -35,10 +35,8 @@ func (s *Server) handleConn(ctx context.Context, conn net.Conn) { fmt.Println(err) } }() - defer conn.Close() - // Set timeout for login phase - conn.SetDeadline(getTimeBySecondsInFuture(s.cfg.ConnectionTimeoutSeconds)) + defer conn.Close() if err := sendServerIdent(conn); err != nil { fmt.Printf("Error sending server ident: %v\n", err) diff --git a/fsd/env.go b/fsd/env.go index fd32fbf..b4befc1 100644 --- a/fsd/env.go +++ b/fsd/env.go @@ -16,9 +16,6 @@ type ServerConfig struct { NumMetarWorkers int `env:"NUM_METAR_WORKERS, default=4"` // Number of METAR fetch workers to run ServiceHTTPListenAddr string `env:"SERVICE_HTTP_LISTEN_ADDR, default=:13618"` - - // Seconds after which a connection will be closed for inactivity - ConnectionTimeoutSeconds int `env:"CONNECTION_TIMEOUT_SECONDS, default=30"` } func loadServerConfig(ctx context.Context) (config *ServerConfig, err error) { diff --git a/fsd/util.go b/fsd/util.go index 692c243..8629527 100644 --- a/fsd/util.go +++ b/fsd/util.go @@ -7,7 +7,6 @@ import ( "slices" "strconv" "strings" - "time" ) // FSD error codes @@ -419,8 +418,3 @@ func sendSendFastPacket(client *Client, enabled bool) { client.send(builder.String()) } - -// getTimeBySecondsInFuture returns time.Now + seconds -func getTimeBySecondsInFuture(seconds int) time.Time { - return time.Now().Add(time.Duration(seconds) * time.Second) -}