From 96d07ec30ab2b262839fe362a64cb064cf7c107e Mon Sep 17 00:00:00 2001 From: woorui Date: Sun, 26 Nov 2023 17:07:20 +0800 Subject: [PATCH] fix: reconnect --- core/client.go | 8 ++------ core/server.go | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/client.go b/core/client.go index 9fb631d85..16598cd43 100644 --- a/core/client.go +++ b/core/client.go @@ -221,13 +221,9 @@ func (c *Client) handleConn(ctx context.Context, conn frame.Conn) error { for { select { case <-ctx.Done(): - se := errors.New("yomo: parent context done") - conn.CloseWithError(se.Error()) - return se + conn.CloseWithError("yomo: parent context done") case <-c.ctx.Done(): - se := context.Cause(c.ctx) - conn.CloseWithError(se.Error()) - return se + conn.CloseWithError(context.Cause(c.ctx).Error()) case f := <-c.wrCh: if err := conn.WriteFrame(f); err != nil { return err diff --git a/core/server.go b/core/server.go index e0438fe40..3ef258f90 100644 --- a/core/server.go +++ b/core/server.go @@ -223,7 +223,7 @@ func (s *Server) handleFrameConn(fconn frame.Conn, logger *slog.Logger) { return } - s.connHandler(conn, route) // s.handleConn(conn) with middlewares + s.connHandler(conn, route) // s.handleConnRoute(conn, route) with middlewares if conn.ClientType() == ClientTypeStreamFunction { _ = route.Remove(conn.ID())