From d5879d777aa6141d11a116fb6286c613bccc1b78 Mon Sep 17 00:00:00 2001 From: oneRain Date: Tue, 23 Jun 2020 16:38:18 +0800 Subject: [PATCH] rename --- .../Internal/Connection/LCConnection.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Realtime/Realtime/Internal/Connection/LCConnection.cs b/Realtime/Realtime/Internal/Connection/LCConnection.cs index a2022b4..1d60bc7 100644 --- a/Realtime/Realtime/Internal/Connection/LCConnection.cs +++ b/Realtime/Realtime/Internal/Connection/LCConnection.cs @@ -72,7 +72,7 @@ namespace LeanCloud.Realtime.Internal.Connection { private State state; private Task connectTask; - private readonly Dictionary clients; + private readonly Dictionary idToClients; internal LCConnection(string id) { this.id = id; @@ -83,7 +83,7 @@ namespace LeanCloud.Realtime.Internal.Connection { OnMessage = OnClientMessage, OnClose = OnClientDisconnect }; - clients = new Dictionary(); + idToClients = new Dictionary(); state = State.None; } @@ -207,7 +207,7 @@ namespace LeanCloud.Realtime.Internal.Connection { heartBeat.Pong(); } else { // 通知 - if (clients.TryGetValue(command.PeerId, out LCIMClient client)) { + if (idToClients.TryGetValue(command.PeerId, out LCIMClient client)) { // 通知具体客户端 client.HandleNotification(command); } @@ -221,7 +221,7 @@ namespace LeanCloud.Realtime.Internal.Connection { private void OnClientDisconnect() { state = State.Closed; heartBeat.Stop(); - foreach (LCIMClient client in clients.Values) { + foreach (LCIMClient client in idToClients.Values) { client.HandleDisconnected(); } // 重连 @@ -231,7 +231,7 @@ namespace LeanCloud.Realtime.Internal.Connection { private void OnPingTimeout() { state = State.Closed; _ = ws.Close(); - foreach (LCIMClient client in clients.Values) { + foreach (LCIMClient client in idToClients.Values) { client.HandleDisconnected(); } // 重连 @@ -259,7 +259,7 @@ namespace LeanCloud.Realtime.Internal.Connection { LCLogger.Debug("Reconnected"); ws.OnMessage = OnClientMessage; ws.OnClose = OnClientDisconnect; - foreach (LCIMClient client in clients.Values) { + foreach (LCIMClient client in idToClients.Values) { client.HandleReconnected(); } break; @@ -280,12 +280,12 @@ namespace LeanCloud.Realtime.Internal.Connection { } internal void Register(LCIMClient client) { - clients[client.Id] = client; + idToClients[client.Id] = client; } internal void UnRegister(LCIMClient client) { - clients.Remove(client.Id); - if (clients.Count == 0) { + idToClients.Remove(client.Id); + if (idToClients.Count == 0) { _ = Close(); } }