Procházet zdrojové kódy

修复两个bug,ActorMessageHandler跟ActorMessageLocationHandler两个Reply之前entity有可能已经释放,所以要提前保存fiber

tanghai před 2 roky
rodič
revize
08e2b4978d

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs

@@ -65,7 +65,7 @@ namespace ET.Server
 
                 int rpcId = request.RpcId;
                 Response response = ObjectPool.Instance.Fetch<Response>();
-                
+                Fiber fiber = entity.Fiber();
                 try
                 {
                     await this.Run(ee, request, response);
@@ -77,7 +77,7 @@ namespace ET.Server
                     response.Message = exception.ToString();
                 }
                 response.RpcId = rpcId;
-                entity.Root().GetComponent<ActorInnerComponent>().Reply(fromAddress, response);
+                fiber.ActorInnerComponent.Reply(fromAddress, response);
             }
             catch (Exception e)
             {

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorMessageHandler.cs

@@ -68,7 +68,7 @@ namespace ET
 
                 int rpcId = request.RpcId;
                 Response response = ObjectPool.Instance.Fetch<Response>();
-                
+                Fiber fiber = entity.Fiber();
                 try
                 {
                     await this.Run(ee, request, response);
@@ -81,7 +81,7 @@ namespace ET
                 }
                 
                 response.RpcId = rpcId;
-                entity.Root().GetComponent<ActorInnerComponent>().Reply(fromAddress, response);
+                fiber.ActorInnerComponent.Reply(fromAddress, response);
             }
             catch (Exception e)
             {