diff --git a/Realtime/Realtime/Internal/Connection/LCConnection.cs b/Realtime/Realtime/Internal/Connection/LCConnection.cs index 1d60bc7..2f11347 100644 --- a/Realtime/Realtime/Internal/Connection/LCConnection.cs +++ b/Realtime/Realtime/Internal/Connection/LCConnection.cs @@ -123,6 +123,7 @@ namespace LeanCloud.Realtime.Internal.Connection { /// /// internal async Task Reset() { + state = State.Closed; heartBeat?.Stop(); // 关闭就连接 await ws.Close(); @@ -205,6 +206,8 @@ namespace LeanCloud.Realtime.Internal.Connection { } else { if (command.Cmd == CommandType.Echo) { heartBeat.Pong(); + } else if (command.Cmd == CommandType.Goaway) { + _ = Reset(); } else { // 通知 if (idToClients.TryGetValue(command.PeerId, out LCIMClient client)) { diff --git a/Realtime/Realtime/Internal/Controller/LCIMGoAwayController.cs b/Realtime/Realtime/Internal/Controller/LCIMGoAwayController.cs deleted file mode 100644 index 35d4518..0000000 --- a/Realtime/Realtime/Internal/Controller/LCIMGoAwayController.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Threading.Tasks; -using LeanCloud.Realtime.Internal.Protocol; - -namespace LeanCloud.Realtime.Internal.Controller { - internal class LCIMGoAwayController : LCIMController { - internal LCIMGoAwayController(LCIMClient client) : base(client) { - - } - - #region 消息处理 - - internal override void HandleNotification(GenericCommand notification) { - // 清空缓存,断开连接,等待重新连接 - _ = Connection.Reset(); - } - - #endregion - } -} diff --git a/Realtime/Realtime/LCIMClient.cs b/Realtime/Realtime/LCIMClient.cs index 6402076..6e08d3c 100644 --- a/Realtime/Realtime/LCIMClient.cs +++ b/Realtime/Realtime/LCIMClient.cs @@ -240,10 +240,6 @@ namespace LeanCloud.Realtime { get; private set; } - internal LCIMGoAwayController GoAwayController { - get; private set; - } - internal LCIMConversationController ConversationController { get; private set; } @@ -290,7 +286,6 @@ namespace LeanCloud.Realtime { SessionController = new LCIMSessionController(this); ConversationController = new LCIMConversationController(this); MessageController = new LCIMMessageController(this); - GoAwayController = new LCIMGoAwayController(this); } /// @@ -451,9 +446,6 @@ namespace LeanCloud.Realtime { case CommandType.Rcp: MessageController.HandleNotification(notification); break; - case CommandType.Goaway: - GoAwayController.HandleNotification(notification); - break; default: break; }