fix: set StateReady after temporary accept error retry

When Accept() returns a transient error, the service enters StateFailed,
sleeps for the retry delay, then loops back to Accept(). Previously the
state stayed StateFailed until the next successful Accept() — which
could take arbitrarily long for idle services, making status observers
see a stale 'error' even though the service has already reconnected
and is ready.

Now set StateReady (and clear lastError) immediately after the retry
sleep. The redundant state transition on successful Accept is removed
since recovery is handled once after the sleep.
This commit is contained in:
ginuerzh
2026-06-17 21:35:49 +08:00
parent c5b62d41ae
commit ca582a147f
-2
View File
@@ -250,8 +250,6 @@ func (s *defaultService) Serve() error {
if tempDelay > 0 { if tempDelay > 0 {
tempDelay = 0 tempDelay = 0
s.setState(StateReady)
s.status.setLastError(nil)
} }
ctx := gctx ctx := gctx