Просмотр исходного кода

1.MessageOuterSender在OnRead的时候加了一层分发
2.默认时Mailbox类型的分发,这种分发就跟MessageInnerSender是一样的效果,直接把消息加到Mailbox中去
3.NetInner Scene会使用NetInner分发,这种分发就是原来的NetInner实现
4.这样设计的原因是,每个纤程都可以挂上MessageOuterSender 使用Mailbox类型的分发来收发网络消息,这样就不需要通过NetInner中转
大家按需选择
另外
MessageInnerSender改为ProcessInnerSender,MessageOuterSender改为ProcessOuterSender
因为Inner跟Outer是进程的内外,这样命名更清晰

tanghai 2 лет назад
Родитель
Сommit
0f0196c114
54 измененных файлов с 322 добавлено и 197 удалено
  1. 4 4
      Unity/Assets/Scripts/Core/Fiber/Fiber.cs
  2. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSender.cs
  3. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSender.cs.meta
  4. 16 16
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSenderSystem.cs
  5. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSenderSystem.cs.meta
  6. 3 3
      Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs
  7. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/FiberInit_NetClient.cs
  8. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs
  9. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Router/RouterHelper.cs
  10. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs
  11. 2 2
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetComponentOnReadInvoker_NetClient.cs
  12. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetComponentOnReadInvoker_NetClient.cs.meta
  13. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Benchmark/BenchmarkClientComponentSystem.cs
  14. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Benchmark/FiberInit_BenchmarkClient.cs
  15. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Benchmark/FiberInit_BenchmarkServer.cs
  16. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Benchmark/NetComponentOnReadInvoker_BenchmarkServer.cs
  17. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Benchmark/NetComponentOnReadInvoker_BenchmarkServer.cs.meta
  18. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs
  19. 1 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetComponentOnReadInvoker_Gate.cs
  20. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetComponentOnReadInvoker_Gate.cs.meta
  21. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs
  22. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/NetComponentOnReadInvoker_Realm.cs
  23. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/NetComponentOnReadInvoker_Realm.cs.meta
  24. 0 11
      Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/NetOuterComponentOnReadInvoker_Realm.cs.meta
  25. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/FiberInit_Robot.cs
  26. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FiberInit_Map.cs
  27. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/FiberInit_Match.cs
  28. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/FiberInit_RoomRoot.cs
  29. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs
  30. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/MessageLocationHandler.cs
  31. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs
  32. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_RequestHandler.cs
  33. 0 11
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/MessageOuterSenderSystem.cs.meta
  34. 3 3
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/MessageSenderSystem.cs
  35. 33 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/ProcessOuterSenderOnReadInvoker_Mailbox.cs
  36. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/ProcessOuterSenderOnReadInvoker_Mailbox.cs.meta
  37. 50 48
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/ProcessOuterSenderSystem.cs
  38. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/ProcessOuterSenderSystem.cs.meta
  39. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs
  40. 42 0
      Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/ProcessOuterSenderOnReadInvoker_NetInner.cs
  41. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/ProcessOuterSenderOnReadInvoker_NetInner.cs.meta
  42. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Demo/EntryEvent1_InitShare.cs
  43. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs
  44. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Actor/MessageHandler.cs
  45. 11 11
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/NetComponentSystem.cs
  46. 11 0
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/NetComponentSystem.cs.meta
  47. 0 11
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/NetOuterComponentSystem.cs.meta
  48. 0 19
      Unity/Assets/Scripts/Model/Server/Module/Message/MessageOuterSender.cs
  49. 0 11
      Unity/Assets/Scripts/Model/Server/Module/Message/MessageOuterSender.cs.meta
  50. 35 0
      Unity/Assets/Scripts/Model/Server/Module/Message/ProcessOuterSender.cs
  51. 11 0
      Unity/Assets/Scripts/Model/Server/Module/Message/ProcessOuterSender.cs.meta
  52. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Message/NetComponent.cs
  53. 11 0
      Unity/Assets/Scripts/Model/Share/Module/Message/NetComponent.cs.meta
  54. 0 11
      Unity/Assets/Scripts/Model/Share/Module/Message/NetOuterComponent.cs.meta

+ 4 - 4
Unity/Assets/Scripts/Core/Fiber/Fiber.cs

@@ -70,16 +70,16 @@ namespace ET
             }
         }
         
-        private EntityRef<MessageInnerSender> messageInnerSender;
-        public MessageInnerSender MessageInnerSender
+        private EntityRef<ProcessInnerSender> processInnerSender;
+        public ProcessInnerSender ProcessInnerSender
         {
             get
             {
-                return this.messageInnerSender;
+                return this.processInnerSender;
             }
             set
             {
-                this.messageInnerSender = value;
+                this.processInnerSender = value;
             }
         }
 

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/Actor/MessageInnerSender.cs → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSender.cs

@@ -3,7 +3,7 @@
 namespace ET
 {
     [ComponentOf(typeof(Scene))]
-    public class MessageInnerSender: Entity, IAwake, IDestroy, IUpdate
+    public class ProcessInnerSender: Entity, IAwake, IDestroy, IUpdate
     {
         public const long TIMEOUT_TIME = 40 * 1000;
         

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetOuterComponentOnReadInvoker_NetClient.cs.meta → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSender.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: a717e8152c0929841b5a0ba8f74162bb
+guid: 98be14c481e97ce4090a27d1d46f5a93
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 16 - 16
Unity/Assets/Scripts/Core/Fiber/Module/Actor/MessageInnerSenderSystem.cs → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSenderSystem.cs

@@ -4,27 +4,27 @@ using System.IO;
 
 namespace ET
 {
-    [EntitySystemOf(typeof(MessageInnerSender))]
-    [FriendOf(typeof(MessageInnerSender))]
-    public static partial class MessageInnerSenderSystem
+    [EntitySystemOf(typeof(ProcessInnerSender))]
+    [FriendOf(typeof(ProcessInnerSender))]
+    public static partial class ProcessInnerSenderSystem
     {
         [EntitySystem]
-        private static void Destroy(this MessageInnerSender self)
+        private static void Destroy(this ProcessInnerSender self)
         {
             Fiber fiber = self.Fiber();
             MessageQueue.Instance.RemoveQueue(fiber.Id);
         }
 
         [EntitySystem]
-        private static void Awake(this MessageInnerSender self)
+        private static void Awake(this ProcessInnerSender self)
         {
             Fiber fiber = self.Fiber();
             MessageQueue.Instance.AddQueue(fiber.Id);
-            fiber.MessageInnerSender = self;
+            fiber.ProcessInnerSender = self;
         }
 
         [EntitySystem]
-        private static void Update(this MessageInnerSender self)
+        private static void Update(this ProcessInnerSender self)
         {
             self.list.Clear();
             Fiber fiber = self.Fiber();
@@ -36,7 +36,7 @@ namespace ET
             }
         }
 
-        private static void HandleMessage(this MessageInnerSender self, Fiber fiber, in MessageInfo messageInfo)
+        private static void HandleMessage(this ProcessInnerSender self, Fiber fiber, in MessageInfo messageInfo)
         {
             if (messageInfo.MessageObject is IResponse response)
             {
@@ -62,7 +62,7 @@ namespace ET
             mailBoxComponent.Add(actorId.Address, message);
         }
 
-        private static void HandleIActorResponse(this MessageInnerSender self, IResponse response)
+        private static void HandleIActorResponse(this ProcessInnerSender self, IResponse response)
         {
             if (!self.requestCallback.Remove(response.RpcId, out MessageSenderStruct actorMessageSender))
             {
@@ -89,17 +89,17 @@ namespace ET
             ((MessageObject)response).Dispose();
         }
         
-        public static void Reply(this MessageInnerSender self, Address fromAddress, IResponse message)
+        public static void Reply(this ProcessInnerSender self, Address fromAddress, IResponse message)
         {
             self.SendInner(new ActorId(fromAddress, 0), (MessageObject)message);
         }
 
-        public static void Send(this MessageInnerSender self, ActorId actorId, IMessage message)
+        public static void Send(this ProcessInnerSender self, ActorId actorId, IMessage message)
         {
             self.SendInner(actorId, (MessageObject)message);
         }
 
-        private static void SendInner(this MessageInnerSender self, ActorId actorId, MessageObject message)
+        private static void SendInner(this ProcessInnerSender self, ActorId actorId, MessageObject message)
         {
             Fiber fiber = self.Fiber();
             
@@ -118,13 +118,13 @@ namespace ET
             MessageQueue.Instance.Send(fiber.Address, actorId, message);
         }
 
-        public static int GetRpcId(this MessageInnerSender self)
+        public static int GetRpcId(this ProcessInnerSender self)
         {
             return ++self.RpcId;
         }
 
         public static async ETTask<IResponse> Call(
-                this MessageInnerSender self,
+                this ProcessInnerSender self,
                 ActorId actorId,
                 IRequest request,
                 bool needException = true
@@ -141,7 +141,7 @@ namespace ET
         }
         
         public static async ETTask<IResponse> Call(
-                this MessageInnerSender self,
+                this ProcessInnerSender self,
                 ActorId actorId,
                 int rpcId,
                 IRequest iRequest,
@@ -167,7 +167,7 @@ namespace ET
             
             async ETTask Timeout()
             {
-                await fiber.TimerComponent.WaitAsync(MessageInnerSender.TIMEOUT_TIME);
+                await fiber.TimerComponent.WaitAsync(ProcessInnerSender.TIMEOUT_TIME);
 
                 if (!self.requestCallback.Remove(rpcId, out MessageSenderStruct action))
                 {

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/Actor/MessageInnerSender.cs.meta → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSenderSystem.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 090783862ff8cf142af6a9b087212565
+guid: 7478c84bbc773884896d27a642cc886d
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs

@@ -35,7 +35,7 @@ namespace ET.Client
             self.fiberId = await FiberManager.Instance.Create(SchedulerType.ThreadPool, 0, SceneType.NetClient, "");
             self.netClientActorId = new ActorId(self.Fiber().Process, self.fiberId);
 
-            NetClient2Main_Login response = await self.Fiber().MessageInnerSender.Call(self.netClientActorId, new Main2NetClient_Login()
+            NetClient2Main_Login response = await self.Fiber().ProcessInnerSender.Call(self.netClientActorId, new Main2NetClient_Login()
             {
                 OwnerFiberId = self.Fiber().Id, Account = account, Password = password
             }) as NetClient2Main_Login;
@@ -46,14 +46,14 @@ namespace ET.Client
         {
             A2NetClient_Message a2NetClientMessage = A2NetClient_Message.Create();
             a2NetClientMessage.MessageObject = message;
-            self.Fiber().MessageInnerSender.Send(self.netClientActorId, a2NetClientMessage);
+            self.Fiber().ProcessInnerSender.Send(self.netClientActorId, a2NetClientMessage);
         }
 
         public static async ETTask<IResponse> Call(this ClientSenderCompnent self, IRequest request, bool needException = true)
         {
             A2NetClient_Request a2NetClientRequest = A2NetClient_Request.Create();
             a2NetClientRequest.MessageObject = request;
-            A2NetClient_Response a2NetClientResponse = await self.Fiber().MessageInnerSender.Call(self.netClientActorId, a2NetClientRequest) as A2NetClient_Response;
+            A2NetClient_Response a2NetClientResponse = await self.Fiber().ProcessInnerSender.Call(self.netClientActorId, a2NetClientRequest) as A2NetClient_Response;
             IResponse response = a2NetClientResponse.MessageObject;
                         
             if (response.Error == ErrorCore.ERR_MessageTimeout)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/FiberInit_NetClient.cs

@@ -9,7 +9,7 @@
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             root.AddComponent<FiberParentComponent>();
             await ETTask.CompletedTask;
         }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs

@@ -19,7 +19,7 @@ namespace ET.Client
                 routerAddressComponent =
                         root.AddComponent<RouterAddressComponent, string, int>(ConstValue.RouterHttpHost, ConstValue.RouterHttpPort);
                 await routerAddressComponent.Init();
-                root.AddComponent<NetOuterComponent, AddressFamily>(routerAddressComponent.RouterManagerIPAddress.AddressFamily);
+                root.AddComponent<NetComponent, AddressFamily>(routerAddressComponent.RouterManagerIPAddress.AddressFamily);
                 root.GetComponent<FiberParentComponent>().ParentFiberId = request.OwnerFiberId;
             }
             IPEndPoint realmAddress = routerAddressComponent.GetRealmAddress(account);

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Router/RouterHelper.cs

@@ -18,7 +18,7 @@ namespace ET.Client
             
             root.Fiber().Info($"get router: {recvLocalConn} {routerAddress}");
 
-            Session routerSession = root.GetComponent<NetOuterComponent>().Create(routerAddress, address, recvLocalConn);
+            Session routerSession = root.GetComponent<NetComponent>().Create(routerAddress, address, recvLocalConn);
             routerSession.AddComponent<PingComponent>();
             routerSession.AddComponent<RouterCheckComponent>();
             

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs

@@ -19,7 +19,7 @@
             }
             NetClient2Main_SessionDispose message = NetClient2Main_SessionDispose.Create();
             message.Error = self.GetParent<Session>().Error;
-            fiber.MessageInnerSender.Send(new ActorId(fiber.Process, ConstFiberId.Main), message);
+            fiber.ProcessInnerSender.Send(new ActorId(fiber.Process, ConstFiberId.Main), message);
         }
     }
 }

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetOuterComponentOnReadInvoker_NetClient.cs → Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetComponentOnReadInvoker_NetClient.cs

@@ -3,7 +3,7 @@
 namespace ET.Client
 {
     [Invoke((long)SceneType.NetClient)]
-    public class NetOuterComponentOnReadInvoker_NetClient: AInvokeHandler<NetOuterComponentOnRead>
+    public class NetComponentOnReadInvoker_NetClient: AInvokeHandler<NetOuterComponentOnRead>
     {
         public override void Handle(NetOuterComponentOnRead args)
         {
@@ -27,7 +27,7 @@ namespace ET.Client
                 {
                     // 扔到Main纤程队列中
                     int parentFiberId = fiber.Root.GetComponent<FiberParentComponent>().ParentFiberId;
-                    fiber.MessageInnerSender.Send(new ActorId(fiber.Process, parentFiberId), iActorMessage);
+                    fiber.ProcessInnerSender.Send(new ActorId(fiber.Process, parentFiberId), iActorMessage);
                     break;
                 }
                 default:

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetOuterComponentOnReadInvoker_Gate.cs.meta → Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetComponentOnReadInvoker_NetClient.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: a2baa23740353974ebec1863ff353d72
+guid: d9f73d93616e4a74db7cb244f529377e
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Benchmark/BenchmarkClientComponentSystem.cs

@@ -18,8 +18,8 @@ namespace ET.Server
 
         private static async ETTask Start(this BenchmarkClientComponent self)
         {
-            NetOuterComponent netOuterClientComponent = self.Root().GetComponent<NetOuterComponent>();
-            using Session session = netOuterClientComponent.Create(StartSceneConfigCategory.Instance.Benchmark.OuterIPPort);
+            NetComponent netClientComponent = self.Root().GetComponent<NetComponent>();
+            using Session session = netClientComponent.Create(StartSceneConfigCategory.Instance.Benchmark.OuterIPPort);
             List<ETTask> list = new List<ETTask>(100000);
 
             async ETTask Call(Session s)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Benchmark/FiberInit_BenchmarkClient.cs

@@ -19,7 +19,7 @@ namespace ET.Server
             //root.AddComponent<GateSessionKeyComponent>();
             //root.AddComponent<LocationProxyComponent>();
             //root.AddComponent<ActorLocationSenderComponent>();
-            root.AddComponent<NetOuterComponent, AddressFamily>(AddressFamily.InterNetwork);
+            root.AddComponent<NetComponent, AddressFamily>(AddressFamily.InterNetwork);
             root.AddComponent<BenchmarkClientComponent>();
             await ETTask.CompletedTask;
         }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Benchmark/FiberInit_BenchmarkServer.cs

@@ -19,7 +19,7 @@ namespace ET.Server
             //root.AddComponent<GateSessionKeyComponent>();
             //root.AddComponent<LocationProxyComponent>();
             //root.AddComponent<ActorLocationSenderComponent>();
-            root.AddComponent<NetOuterComponent, IPEndPoint>(StartSceneConfigCategory.Instance.Benchmark.OuterIPPort);
+            root.AddComponent<NetComponent, IPEndPoint>(StartSceneConfigCategory.Instance.Benchmark.OuterIPPort);
             root.AddComponent<BenchmarkServerComponent>();
             await ETTask.CompletedTask;
         }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Benchmark/NetOuterComponentOnReadInvoker_BenchmarkServer.cs → Unity/Assets/Scripts/Hotfix/Server/Benchmark/NetComponentOnReadInvoker_BenchmarkServer.cs

@@ -3,7 +3,7 @@
 namespace ET.Server
 {
     [Invoke((long)SceneType.BenchmarkServer)]
-    public class NetOuterComponentOnReadInvoker_BenchmarkServer: AInvokeHandler<NetOuterComponentOnRead>
+    public class NetComponentOnReadInvoker_BenchmarkServer: AInvokeHandler<NetOuterComponentOnRead>
     {
         public override void Handle(NetOuterComponentOnRead args)
         {

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/Actor/MessageInnerSenderSystem.cs.meta → Unity/Assets/Scripts/Hotfix/Server/Benchmark/NetComponentOnReadInvoker_BenchmarkServer.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: f758847937334d94592a56039858191e
+guid: 3f400407796607144bf9eebf438b4c70
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs

@@ -11,7 +11,7 @@ namespace ET.Server
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             root.AddComponent<MessageSender>();
             root.AddComponent<PlayerComponent>();
             root.AddComponent<GateSessionKeyComponent>();
@@ -19,7 +19,7 @@ namespace ET.Server
             root.AddComponent<MessageLocationSenderComponent>();
 
             StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)root.Id);
-            root.AddComponent<NetOuterComponent, IPEndPoint>(startSceneConfig.InnerIPPort);
+            root.AddComponent<NetComponent, IPEndPoint>(startSceneConfig.InnerIPPort);
             await ETTask.CompletedTask;
         }
     }

+ 1 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetOuterComponentOnReadInvoker_Gate.cs → Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetComponentOnReadInvoker_Gate.cs

@@ -3,8 +3,7 @@
 namespace ET.Server
 {
     [Invoke((long)SceneType.Gate)]
-    //[Invoke((long)SceneType.Realm)]
-    public class NetOuterComponentOnReadInvoker_Gate: AInvokeHandler<NetOuterComponentOnRead>
+    public class NetComponentOnReadInvoker_Gate: AInvokeHandler<NetOuterComponentOnRead>
     {
         public override void Handle(NetOuterComponentOnRead args)
         {

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetComponentOnReadInvoker_Gate.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ccf7eaa10578c284ab601768b1abdf05
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs

@@ -11,10 +11,10 @@ namespace ET.Server
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             root.AddComponent<MessageSender>();
             StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get(root.Fiber.Id);
-            root.AddComponent<NetOuterComponent, IPEndPoint>(startSceneConfig.InnerIPPort);
+            root.AddComponent<NetComponent, IPEndPoint>(startSceneConfig.InnerIPPort);
 
             await ETTask.CompletedTask;
         }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/NetOuterComponentOnReadInvoker_Realm.cs → Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/NetComponentOnReadInvoker_Realm.cs

@@ -3,7 +3,7 @@
 namespace ET.Server
 {
     [Invoke((long)SceneType.Realm)]
-    public class NetOuterComponentOnReadInvoker_Realm: AInvokeHandler<NetOuterComponentOnRead>
+    public class NetComponentOnReadInvoker_Realm: AInvokeHandler<NetOuterComponentOnRead>
     {
         public override void Handle(NetOuterComponentOnRead args)
         {

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/NetComponentOnReadInvoker_Realm.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ad7bc5dcdeaec2e4c8025c909ab36754
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 11
Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/NetOuterComponentOnReadInvoker_Realm.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 50c06c8dfbc01a348ad36c35d5d51685
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/FiberInit_Robot.cs

@@ -9,7 +9,7 @@
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             root.AddComponent<PlayerComponent>();
             root.AddComponent<CurrentScenesComponent>();
             root.AddComponent<ObjectWait>();

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FiberInit_Map.cs

@@ -11,7 +11,7 @@ namespace ET.Server
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             root.AddComponent<MessageSender>();
             root.AddComponent<UnitComponent>();
             root.AddComponent<AOIManagerComponent>();

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/FiberInit_Match.cs

@@ -11,7 +11,7 @@ namespace ET.Server
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             root.AddComponent<MessageSender>();
             root.AddComponent<MatchComponent>();
             root.AddComponent<LocationProxyComponent>();

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/FiberInit_RoomRoot.cs

@@ -11,7 +11,7 @@ namespace ET.Server
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             root.AddComponent<MessageSender>();
             Room room = root.AddChild<Room>();
             root.AddComponent<LocationProxyComponent>();

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs

@@ -11,7 +11,7 @@ namespace ET.Server
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             root.AddComponent<MessageSender>();
             root.AddComponent<LocationManagerComoponent>();
 

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

@@ -24,7 +24,7 @@ namespace ET.Server
             }
             
             MessageResponse response = new() {RpcId = message.RpcId};
-            fiber.Root.GetComponent<MessageInnerSender>().Reply(fromAddress, response);
+            fiber.Root.GetComponent<ProcessInnerSender>().Reply(fromAddress, response);
 
             await this.Run(e, message);
         }
@@ -82,7 +82,7 @@ namespace ET.Server
                     response.Message = exception.ToString();
                 }
                 response.RpcId = rpcId;
-                fiber.MessageInnerSender.Reply(fromAddress, response);
+                fiber.ProcessInnerSender.Reply(fromAddress, response);
             }
             catch (Exception e)
             {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs

@@ -7,7 +7,7 @@ namespace ET.Server
     {
         protected override async ETTask Run(Scene root, A2NetInner_Message innerMessage)
         {
-            root.GetComponent<MessageOuterSender>().Send(innerMessage.ActorId, innerMessage.MessageObject);
+            root.GetComponent<ProcessOuterSender>().Send(innerMessage.ActorId, innerMessage.MessageObject);
             await ETTask.CompletedTask;
         }
     }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_RequestHandler.cs

@@ -7,7 +7,7 @@ namespace ET.Server
     {
         protected override async ETTask Run(Scene root, A2NetInner_Request request, A2NetInner_Response response)
         {
-            response.MessageObject = await root.GetComponent<MessageOuterSender>().Call(request.ActorId, request.MessageObject, false);
+            response.MessageObject = await root.GetComponent<ProcessOuterSender>().Call(request.ActorId, request.MessageObject, false);
         }
     }
 }

+ 0 - 11
Unity/Assets/Scripts/Hotfix/Server/Module/Message/MessageOuterSenderSystem.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: fefdece88f1ea2c439de496ff7396c41
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Server/Module/Message/MessageSenderSystem.cs

@@ -13,7 +13,7 @@ namespace ET.Server
             // 如果发向同一个进程,则扔到消息队列中
             if (actorId.Process == fiber.Process)
             {
-                fiber.MessageInnerSender.Send(actorId, message);
+                fiber.ProcessInnerSender.Send(actorId, message);
                 return;
             }
             
@@ -65,7 +65,7 @@ namespace ET.Server
             
             if (fiber.Process == actorId.Process)
             {
-                return await fiber.MessageInnerSender.Call(actorId, rpcId, request, needException: needException);
+                return await fiber.ProcessInnerSender.Call(actorId, rpcId, request, needException: needException);
             }
 
             // 发给NetInner纤程
@@ -73,7 +73,7 @@ namespace ET.Server
             a2NetInner_Request.ActorId = actorId;
             a2NetInner_Request.MessageObject = request;
             StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.NetInners[fiber.Process];
-            A2NetInner_Response a2NetInnerResponse = await fiber.MessageInnerSender.Call(
+            A2NetInner_Response a2NetInnerResponse = await fiber.ProcessInnerSender.Call(
                 startSceneConfig.ActorId, a2NetInner_Request) as A2NetInner_Response;
             IResponse response = a2NetInnerResponse.MessageObject;
             

+ 33 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Message/ProcessOuterSenderOnReadInvoker_Mailbox.cs

@@ -0,0 +1,33 @@
+using System;
+
+namespace ET.Server
+{
+    [Invoke(ProcessOuterSenderInvokerType.Mailbox)]
+    public class ProcessOuterSenderOnReadInvoker_Mailbox: AInvokeHandler<ProcessOuterSenderOnRead>
+    {
+        public override void Handle(ProcessOuterSenderOnRead args)
+        {
+            ProcessOuterSender processOuterSender = args.ProcessOuterSender;
+            Fiber fiber = processOuterSender.Fiber();
+            ActorId actorId = args.ActorId;
+            MessageObject message = (MessageObject)args.Message;
+            
+            int fromProcess = actorId.Process;
+            actorId.Process = fiber.Process;
+            
+            MailBoxComponent mailBoxComponent = fiber.Mailboxes.Get(actorId.InstanceId);
+            if (mailBoxComponent == null)
+            {
+                fiber.Warning($"actor not found mailbox, from: {actorId} current: {fiber.Address} {message}");
+                if (message is IRequest request)
+                {
+                    IResponse resp = MessageHelper.CreateResponse(request, ErrorCore.ERR_NotFoundActor);
+                    processOuterSender.Send(new ActorId(fromProcess, 0), resp);
+                }
+                message.Dispose();
+                return;
+            }
+            mailBoxComponent.Add(actorId.Address, message);
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Message/ProcessOuterSenderOnReadInvoker_Mailbox.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 272b198e3d93d5e4b84633d8e95c2587
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 50 - 48
Unity/Assets/Scripts/Hotfix/Server/Module/Message/MessageOuterSenderSystem.cs → Unity/Assets/Scripts/Hotfix/Server/Module/Message/ProcessOuterSenderSystem.cs

@@ -3,12 +3,12 @@ using System.Net;
 
 namespace ET.Server
 {
-    [EntitySystemOf(typeof(MessageOuterSender))]
-    [FriendOf(typeof(MessageOuterSender))]
-    public static partial class MessageOuterSenderSystem
+    [EntitySystemOf(typeof(ProcessOuterSender))]
+    [FriendOf(typeof(ProcessOuterSender))]
+    public static partial class ProcessOuterSenderSystem
     {
         [EntitySystem]
-        private static void Awake(this MessageOuterSender self, IPEndPoint address)
+        private static void Awake(this ProcessOuterSender self, IPEndPoint address)
         {
             switch (self.InnerProtocol)
             {
@@ -27,21 +27,45 @@ namespace ET.Server
             self.AService.AcceptCallback = self.OnAccept;
             self.AService.ReadCallback = self.OnRead;
             self.AService.ErrorCallback = self.OnError;
+            self.InvokerType = ProcessOuterSenderInvokerType.Mailbox;
         }
         
         [EntitySystem]
-        private static void Update(this MessageOuterSender self)
+        private static void Awake(this ProcessOuterSender self, IPEndPoint address, int invokerType)
+        {
+            switch (self.InnerProtocol)
+            {
+                case NetworkProtocol.TCP:
+                {
+                    self.AService = new TService(address, ServiceType.Inner, self.Fiber().Log);
+                    break;
+                }
+                case NetworkProtocol.KCP:
+                {
+                    self.AService = new KService(address, ServiceType.Inner, self.Fiber().Log);
+                    break;
+                }
+            }
+                
+            self.AService.AcceptCallback = self.OnAccept;
+            self.AService.ReadCallback = self.OnRead;
+            self.AService.ErrorCallback = self.OnError;
+            self.InvokerType = invokerType;
+        }
+        
+        [EntitySystem]
+        private static void Update(this ProcessOuterSender self)
         {
             self.AService.Update();
         }
 
         [EntitySystem]
-        private static void Destroy(this MessageOuterSender self)
+        private static void Destroy(this ProcessOuterSender self)
         {
             self.AService.Dispose();
         }
 
-        private static void OnRead(this MessageOuterSender self, long channelId, ActorId actorId, object message)
+        private static void OnRead(this ProcessOuterSender self, long channelId, ActorId actorId, object message)
         {
             Session session = self.GetChild<Session>(channelId);
             if (session == null)
@@ -50,42 +74,20 @@ namespace ET.Server
             }
             
             session.LastRecvTime = TimeInfo.Instance.ClientFrameTime();
-
-            self.HandleMessage(actorId, message).Coroutine();
-        }
-
-        private static async ETTask HandleMessage(this MessageOuterSender self, ActorId actorId, object message)
-        {
-            Fiber fiber = self.Fiber();
-            int fromProcess = actorId.Process;
-            actorId.Process = fiber.Process;
-
-            switch (message)
+            
+            if (message is IResponse response)
             {
-                case IResponse iActorResponse:
-                {
-                    self.HandleIActorResponse(iActorResponse);
-                    return;
-                }
-                case ILocationRequest:
-                case IRequest:
-                {
-                    IRequest request = (IRequest)message;
-                    // 注意这里都不能抛异常,因为这里只是中转消息
-                    IResponse response = await fiber.MessageInnerSender.Call(actorId, request, false);
-                    actorId.Process = fromProcess;
-                    self.Send(actorId, response);
-                    break;
-                }
-                default:
-                {
-                    fiber.MessageInnerSender.Send(actorId, (IMessage)message);
-                    break;
-                }
+                self.HandleIActorResponse(response);
+                return;
             }
+
+            EventSystem.Instance.Invoke(self.InvokerType, new ProcessOuterSenderOnRead()
+            {
+                ProcessOuterSender = self, ActorId = actorId, Message = message
+            });
         }
 
-        private static void OnError(this MessageOuterSender self, long channelId, int error)
+        private static void OnError(this ProcessOuterSender self, long channelId, int error)
         {
             Session session = self.GetChild<Session>(channelId);
             if (session == null)
@@ -98,14 +100,14 @@ namespace ET.Server
         }
 
         // 这个channelId是由CreateAcceptChannelId生成的
-        private static void OnAccept(this MessageOuterSender self, long channelId, IPEndPoint ipEndPoint)
+        private static void OnAccept(this ProcessOuterSender self, long channelId, IPEndPoint ipEndPoint)
         {
             Session session = self.AddChildWithId<Session, AService>(channelId, self.AService);
             session.RemoteAddress = ipEndPoint;
             //session.AddComponent<SessionIdleCheckerComponent, int, int, int>(NetThreadComponent.checkInteral, NetThreadComponent.recvMaxIdleTime, NetThreadComponent.sendMaxIdleTime);
         }
 
-        private static Session CreateInner(this MessageOuterSender self, long channelId, IPEndPoint ipEndPoint)
+        private static Session CreateInner(this ProcessOuterSender self, long channelId, IPEndPoint ipEndPoint)
         {
             Session session = self.AddChildWithId<Session, AService>(channelId, self.AService);
             session.RemoteAddress = ipEndPoint;
@@ -118,7 +120,7 @@ namespace ET.Server
         }
 
         // 内网actor session,channelId是进程号
-        private static Session Get(this MessageOuterSender self, long channelId)
+        private static Session Get(this ProcessOuterSender self, long channelId)
         {
             Session session = self.GetChild<Session>(channelId);
             if (session != null)
@@ -131,7 +133,7 @@ namespace ET.Server
             return session;
         }
 
-        public static void HandleIActorResponse(this MessageOuterSender self, IResponse response)
+        private static void HandleIActorResponse(this ProcessOuterSender self, IResponse response)
         {
             if (!self.requestCallback.Remove(response.RpcId, out MessageSenderStruct actorMessageSender))
             {
@@ -158,12 +160,12 @@ namespace ET.Server
             ((MessageObject)response).Dispose();
         }
 
-        public static void Send(this MessageOuterSender self, ActorId actorId, IMessage message)
+        public static void Send(this ProcessOuterSender self, ActorId actorId, IMessage message)
         {
             self.SendInner(actorId, message as MessageObject);
         }
 
-        private static void SendInner(this MessageOuterSender self, ActorId actorId, MessageObject message)
+        private static void SendInner(this ProcessOuterSender self, ActorId actorId, MessageObject message)
         {
             if (actorId == default)
             {
@@ -183,12 +185,12 @@ namespace ET.Server
             session.Send(actorId, message);
         }
 
-        private static int GetRpcId(this MessageOuterSender self)
+        private static int GetRpcId(this ProcessOuterSender self)
         {
             return ++self.RpcId;
         }
 
-        public static async ETTask<IResponse> Call(this MessageOuterSender self, ActorId actorId, IRequest iRequest, bool needException = true)
+        public static async ETTask<IResponse> Call(this ProcessOuterSender self, ActorId actorId, IRequest iRequest, bool needException = true)
         {
             if (actorId == default)
             {
@@ -206,7 +208,7 @@ namespace ET.Server
 
             async ETTask Timeout()
             {
-                await fiber.TimerComponent.WaitAsync(MessageOuterSender.TIMEOUT_TIME);
+                await fiber.TimerComponent.WaitAsync(ProcessOuterSender.TIMEOUT_TIME);
                 if (!self.requestCallback.Remove(rpcId, out MessageSenderStruct action))
                 {
                     return;

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Message/ProcessOuterSenderSystem.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 31878c11c674ce24587f8c9d7f182216
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs

@@ -12,8 +12,8 @@ namespace ET.Server
             root.AddComponent<TimerComponent>();
             root.AddComponent<CoroutineLockComponent>();
             StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get(fiberInit.Fiber.Id);
-            root.AddComponent<MessageOuterSender, IPEndPoint>(startSceneConfig.InnerIPPort);
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessOuterSender, IPEndPoint, int>(startSceneConfig.InnerIPPort, ProcessOuterSenderInvokerType.NetInner);
+            root.AddComponent<ProcessInnerSender>();
             //root.AddComponent<ActorSenderComponent>();
 
             await ETTask.CompletedTask;

+ 42 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/ProcessOuterSenderOnReadInvoker_NetInner.cs

@@ -0,0 +1,42 @@
+using System;
+
+namespace ET.Server
+{
+    [Invoke(ProcessOuterSenderInvokerType.NetInner)]
+    public class ProcessOuterSenderOnReadInvoker_NetInner: AInvokeHandler<ProcessOuterSenderOnRead>
+    {
+        public override void Handle(ProcessOuterSenderOnRead args)
+        {
+            ProcessOuterSender processOuterSender = args.ProcessOuterSender;
+            Fiber fiber = processOuterSender.Fiber();
+            ActorId actorId = args.ActorId;
+            object message = args.Message;
+            
+            int fromProcess = actorId.Process;
+            actorId.Process = fiber.Process;
+
+            switch (message)
+            {
+                case ILocationRequest:
+                case IRequest:
+                {
+                    async ETTask Call()
+                    {
+                        IRequest request = (IRequest)message;
+                        // 注意这里都不能抛异常,因为这里只是中转消息
+                        IResponse response = await fiber.ProcessInnerSender.Call(actorId, request, false);
+                        actorId.Process = fromProcess;
+                        processOuterSender.Send(actorId, response);
+                    }
+                    Call().Coroutine();
+                    break;
+                }
+                default:
+                {
+                    fiber.ProcessInnerSender.Send(actorId, (IMessage)message);
+                    break;
+                }
+            }
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/ProcessOuterSenderOnReadInvoker_NetInner.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8a136042465332546be6dd3b5b4cfb22
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Demo/EntryEvent1_InitShare.cs

@@ -10,7 +10,7 @@ namespace ET
             root.AddComponent<CoroutineLockComponent>();
             root.AddComponent<ObjectWait>();
             root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
-            root.AddComponent<MessageInnerSender>();
+            root.AddComponent<ProcessInnerSender>();
             
             await ETTask.CompletedTask;
         }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs

@@ -29,7 +29,7 @@
                     if (messageObject is IRequest request)
                     {
                         IResponse resp = MessageHelper.CreateResponse(request, ErrorCore.ERR_NotFoundActor);
-                        mailBoxComponent.Root().GetComponent<MessageInnerSender>().Reply(args.FromAddress, resp);
+                        mailBoxComponent.Root().GetComponent<ProcessInnerSender>().Reply(args.FromAddress, resp);
                     }
                     messageObject.Dispose();
                     return;

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/MessageHandler.cs

@@ -85,7 +85,7 @@ namespace ET
                 }
                 
                 response.RpcId = rpcId;
-                fiber.MessageInnerSender.Reply(fromAddress, response);
+                fiber.ProcessInnerSender.Reply(fromAddress, response);
             }
             catch (Exception e)
             {

+ 11 - 11
Unity/Assets/Scripts/Hotfix/Share/Module/Message/NetOuterComponentSystem.cs → Unity/Assets/Scripts/Hotfix/Share/Module/Message/NetComponentSystem.cs

@@ -3,12 +3,12 @@ using System.Net.Sockets;
 
 namespace ET
 {
-    [EntitySystemOf(typeof(NetOuterComponent))]
-    [FriendOf(typeof(NetOuterComponent))]
+    [EntitySystemOf(typeof(NetComponent))]
+    [FriendOf(typeof(NetComponent))]
     public static partial class NetOuterComponentSystem
     {
         [EntitySystem]
-        private static void Awake(this NetOuterComponent self, IPEndPoint address)
+        private static void Awake(this NetComponent self, IPEndPoint address)
         {
             self.AService = new KService(address, ServiceType.Outer, self.Fiber().Log);
             self.AService.AcceptCallback = self.OnAccept;
@@ -17,7 +17,7 @@ namespace ET
         }
         
         [EntitySystem]
-        private static void Awake(this NetOuterComponent self, AddressFamily addressFamily)
+        private static void Awake(this NetComponent self, AddressFamily addressFamily)
         {
             self.AService = new KService(addressFamily, ServiceType.Outer, self.Fiber().Log);
             self.AService.ReadCallback = self.OnRead;
@@ -25,18 +25,18 @@ namespace ET
         }
         
         [EntitySystem]
-        private static void Update(this NetOuterComponent self)
+        private static void Update(this NetComponent self)
         {
             self.AService.Update();
         }
 
         [EntitySystem]
-        private static void Destroy(this NetOuterComponent self)
+        private static void Destroy(this NetComponent self)
         {
             self.AService.Dispose();
         }
 
-        private static void OnError(this NetOuterComponent self, long channelId, int error)
+        private static void OnError(this NetComponent self, long channelId, int error)
         {
             Session session = self.GetChild<Session>(channelId);
             if (session == null)
@@ -49,7 +49,7 @@ namespace ET
         }
 
         // 这个channelId是由CreateAcceptChannelId生成的
-        private static void OnAccept(this NetOuterComponent self, long channelId, IPEndPoint ipEndPoint)
+        private static void OnAccept(this NetComponent self, long channelId, IPEndPoint ipEndPoint)
         {
             Session session = self.AddChildWithId<Session, AService>(channelId, self.AService);
             session.RemoteAddress = ipEndPoint;
@@ -63,7 +63,7 @@ namespace ET
             }
         }
         
-        private static void OnRead(this NetOuterComponent self, long channelId, ActorId actorId, object message)
+        private static void OnRead(this NetComponent self, long channelId, ActorId actorId, object message)
         {
             Session session = self.GetChild<Session>(channelId);
             if (session == null)
@@ -77,7 +77,7 @@ namespace ET
             EventSystem.Instance.Invoke((long)self.IScene.SceneType, new NetOuterComponentOnRead() {Session = session, Message = message});
         }
         
-        public static Session Create(this NetOuterComponent self, IPEndPoint realIPEndPoint)
+        public static Session Create(this NetComponent self, IPEndPoint realIPEndPoint)
         {
             long channelId = NetServices.Instance.CreateConnectChannelId();
             Session session = self.AddChildWithId<Session, AService>(channelId, self.AService);
@@ -91,7 +91,7 @@ namespace ET
             return session;
         }
 
-        public static Session Create(this NetOuterComponent self, IPEndPoint routerIPEndPoint, IPEndPoint realIPEndPoint, uint localConn)
+        public static Session Create(this NetComponent self, IPEndPoint routerIPEndPoint, IPEndPoint realIPEndPoint, uint localConn)
         {
             long channelId = localConn;
             Session session = self.AddChildWithId<Session, AService>(channelId, self.AService);

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Share/Module/Message/NetComponentSystem.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1c6bafd0bdc5b2c40909d79af98d0aff
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 11
Unity/Assets/Scripts/Hotfix/Share/Module/Message/NetOuterComponentSystem.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 4c0d82cdd1e18474eb59210f801c3fb2
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 19
Unity/Assets/Scripts/Model/Server/Module/Message/MessageOuterSender.cs

@@ -1,19 +0,0 @@
-using System.Collections.Generic;
-using System.Net;
-
-namespace ET.Server
-{
-    [ComponentOf(typeof(Scene))]
-    public class MessageOuterSender: Entity, IAwake<IPEndPoint>, IUpdate, IDestroy
-    {
-        public const long TIMEOUT_TIME = 40 * 1000;
-        
-        public int RpcId;
-
-        public readonly Dictionary<int, MessageSenderStruct> requestCallback = new();
-        
-        public AService AService;
-        
-        public NetworkProtocol InnerProtocol = NetworkProtocol.KCP;
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Model/Server/Module/Message/MessageOuterSender.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: ae06dd3b08fe94f48a5077b9b5e5d07d
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 35 - 0
Unity/Assets/Scripts/Model/Server/Module/Message/ProcessOuterSender.cs

@@ -0,0 +1,35 @@
+using System.Collections.Generic;
+using System.Net;
+
+namespace ET.Server
+{
+    public struct ProcessOuterSenderOnRead
+    {
+        public ProcessOuterSender ProcessOuterSender;
+        public ActorId ActorId;
+        public object Message;
+    }
+
+    public static class ProcessOuterSenderInvokerType
+    {
+        public const int Mailbox = 1;
+        public const int NetInner = 2;
+    }
+    
+    [ComponentOf(typeof(Scene))]
+    public class ProcessOuterSender: Entity, IAwake<IPEndPoint>, IAwake<IPEndPoint, int>, IUpdate, IDestroy
+    {
+        public const long TIMEOUT_TIME = 40 * 1000;
+        
+        public int RpcId;
+
+        public readonly Dictionary<int, MessageSenderStruct> requestCallback = new();
+        
+        public AService AService;
+        
+        public NetworkProtocol InnerProtocol = NetworkProtocol.KCP;
+
+        // OnRead时根据这个进行分发
+        public int InvokerType;
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Model/Server/Module/Message/ProcessOuterSender.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7a52ecacdb3f73e479b6abf418697566
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Message/NetOuterComponent.cs → Unity/Assets/Scripts/Model/Share/Module/Message/NetComponent.cs

@@ -10,7 +10,7 @@ namespace ET
     }
     
     [ComponentOf(typeof(Scene))]
-    public class NetOuterComponent: Entity, IAwake<IPEndPoint>, IAwake<AddressFamily>, IDestroy, IUpdate
+    public class NetComponent: Entity, IAwake<IPEndPoint>, IAwake<AddressFamily>, IDestroy, IUpdate
     {
         public AService AService;
     }

+ 11 - 0
Unity/Assets/Scripts/Model/Share/Module/Message/NetComponent.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b853042f2fda1994e9b15e1c7f30c311
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 11
Unity/Assets/Scripts/Model/Share/Module/Message/NetOuterComponent.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 601b4bb3c982d5a449b053194f808f47
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: