From 40b095286e8b0cd4446c9ca10cdd2f36bbef31fd Mon Sep 17 00:00:00 2001 From: wurui Date: Sat, 14 Dec 2024 12:35:06 +0800 Subject: [PATCH] fix(zipper): continue when listener accepts an error (#957) When an error occurs while the server is accepting a connection, the service should not exit as it could be due to client-side reasons. --- core/server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/server.go b/core/server.go index 6820cec79..2942f8e25 100644 --- a/core/server.go +++ b/core/server.go @@ -143,14 +143,16 @@ func (s *Server) Serve(ctx context.Context, conn net.PacketConn) error { defer closeServer(s.downstreams, s.connector, s.listener, s.router) + errCount := 0 for { fconn, err := s.listener.Accept(s.ctx) if err != nil { if err == s.ctx.Err() { return ErrServerClosed } - s.logger.Error("accepted an error when accepting a connection", "err", err) - return err + errCount++ + s.logger.Error("accepted an error when accepting a connection", "err", err, "err_count", errCount) + continue } go s.handleFrameConn(fconn, s.logger)