chore: session open 之后断开连接

oneRain 2020-04-27 18:11:23 +08:00
parent 9ca71dba39
commit aa832f4cb5
1 changed files with 9 additions and 2 deletions

View File

@ -297,8 +297,15 @@ namespace LeanCloud.Realtime {
/// <returns></returns> /// <returns></returns>
public async Task Open(bool force = true) { public async Task Open(bool force = true) {
await Connection.Connect(); await Connection.Connect();
// 打开 Session try {
await SessionController.Open(force); // 打开 Session
await SessionController.Open(force);
} catch (Exception e) {
LCLogger.Error(e);
// 如果 session 阶段异常,则关闭连接
await Connection.Close();
throw e;
}
} }
/// <summary> /// <summary>