chore: 调整 goaway 处理逻辑
parent
d5879d777a
commit
b353bf5536
|
@ -123,6 +123,7 @@ namespace LeanCloud.Realtime.Internal.Connection {
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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)) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -451,9 +446,6 @@ namespace LeanCloud.Realtime {
|
|||
case CommandType.Rcp:
|
||||
MessageController.HandleNotification(notification);
|
||||
break;
|
||||
case CommandType.Goaway:
|
||||
GoAwayController.HandleNotification(notification);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue