diff --git a/docs/releases.md b/docs/releases.md index 7a05d6bf..1b83f273 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -2355,7 +2355,6 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release **Bug fixes + maintenance:** -* Do not send TCP keep-alive probes on the client listeners (`listen-http`, `listen-https`): Go sends one every 15 seconds on an idle connection by default, which, without a proxy in front of ntfy, woke phones holding a stream three times as often as ntfy's own keepalive event ([#2152](https://github.com/binwiederhier/ntfy/pull/2152)) * `ntfy cluster status` lists the node itself as the first row of the table (marked "this node", and "leader" if it leads) instead of a line above it ([#2153](https://github.com/binwiederhier/ntfy/pull/2153)) * The cluster and admin socket options lost their `experimental-` prefix, e.g. `cluster-listen` instead of `experimental-cluster-listen` (and `NTFY_CLUSTER_LISTEN`); the old names still work ([#2154](https://github.com/binwiederhier/ntfy/pull/2154)) * Send read-only queries to the least busy read replica instead of round-robin, so a replica that stalls stops getting new reads; the new `ntfy_db_ping_seconds` metric shows how long each database takes to answer its health check ([#2156](https://github.com/binwiederhier/ntfy/pull/2156)) diff --git a/server/server.go b/server/server.go index 66123b6f..f9d7a8a5 100644 --- a/server/server.go +++ b/server/server.go @@ -505,23 +505,13 @@ func (s *Server) Run() error { httpServer := &http.Server{Addr: addr, Handler: mux} s.httpServers = append(s.httpServers, httpServer) go func() { - listener, err := listenTCP(addr) - if err != nil { - errChan <- err - return - } - errChan <- httpServer.Serve(listener) + errChan <- httpServer.ListenAndServe() }() } if s.config.ListenHTTPS != "" { s.httpsServer = &http.Server{Addr: s.config.ListenHTTPS, Handler: mux} go func() { - listener, err := listenTCP(s.config.ListenHTTPS) - if err != nil { - errChan <- err - return - } - errChan <- s.httpsServer.ServeTLS(listener, s.config.CertFile, s.config.KeyFile) + errChan <- s.httpsServer.ListenAndServeTLS(s.config.CertFile, s.config.KeyFile) }() } if s.config.ListenUnix != "" { diff --git a/server/util.go b/server/util.go index 0025b4cc..33df051a 100644 --- a/server/util.go +++ b/server/util.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "mime" - "net" "net/http" "net/netip" "regexp" @@ -207,12 +206,3 @@ func isMarkdownContentType(contentType string) bool { } return strings.ToLower(mediaType) == "text/markdown" } - -// listenTCP listens for the clients (listen-http, listen-https) without TCP keep-alive probes. Go -// sends them every 15s on an idle accepted connection by default; to a phone holding a stream, each -// is a radio wake-up, on top of ntfy's own keepalive event (keepalive-interval, 45s), which already -// keeps the connection alive and finds dead ones. -func listenTCP(addr string) (net.Listener, error) { - lc := &net.ListenConfig{KeepAlive: -1} - return lc.Listen(context.Background(), "tcp", addr) -}