mirror of
https://github.com/go-gost/x.git
synced 2026-10-19 16:16:32 +00:00
One connection over the climiter quota killed the whole service. The conn limiter wrapper signals an over-limit connection by returning a plain error from Accept, which the accept loop does not recognise as either a listener.AcceptError or a temporary net.Error, so it fell through to the fatal branch and returned. program.go discards Serve's return value, so the process stayed up with no further logging while nothing accepted connections any more. Every later connection sat in the listen backlog, where the kernel completes the handshake but no service ever reads it, so clients saw a connection that opens and then never negotiates. Only a restart recovered the service. The counter itself was never the problem: llimiter.Allow rolls the count back when it refuses, and a test now pins that. A test also pins that the accept loop survives a rejection and still serves the connection that follows it. Export ErrConnLimit so the refusal can be told apart from a listener that has genuinely failed, and continue the accept loop on it. The plain-http-tunnel listener refused over-limit connections with an identical error and is fixed the same way. Closes #914