|
@@ -1,5 +1,6 @@
|
|
|
using Ice;
|
|
|
using System;
|
|
|
+using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace ET.Server
|
|
@@ -13,8 +14,12 @@ namespace ET.Server
|
|
|
{
|
|
|
BattleIceAgentComponent.Instance = self;
|
|
|
|
|
|
- self.IceApp = new IceApp();
|
|
|
- self.IceApp.main(new string[0], "../Config/ice.config");
|
|
|
+ Thread thread = new Thread(() =>
|
|
|
+ {
|
|
|
+ self.IceApp = new IceApp();
|
|
|
+ self.IceApp.main(new string[0], "../Config/ice.config");
|
|
|
+ });
|
|
|
+ thread.Start();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -22,6 +27,7 @@ namespace ET.Server
|
|
|
{
|
|
|
protected override void Destroy(BattleIceAgentComponent self)
|
|
|
{
|
|
|
+ Log.Info($"Ice component destroyed");
|
|
|
Ice.Application.communicator().Dispose();
|
|
|
}
|
|
|
}
|
|
@@ -49,9 +55,10 @@ namespace ET.Server
|
|
|
ZoneIce.ice_getCachedConnection().setAdapter(adapter);
|
|
|
ZoneIce.setCallback(prx.ice_getIdentity(), Global.GameServerUUID);
|
|
|
|
|
|
- //测试一下ice接口
|
|
|
+ //向战斗服注册本GameServer
|
|
|
var res = ZoneIce.registerGameServer(Global.GameServerId, Global.GameServerId);
|
|
|
- Log.Debug($"registerGameServer ret: {res}");
|
|
|
+ BattleIceAgentComponent.Instance.StrBattleServerVersion = res;
|
|
|
+ Log.Info($"Battle Server version: {res}");
|
|
|
}
|
|
|
catch(Ice.Exception e)
|
|
|
{
|
|
@@ -77,6 +84,8 @@ namespace ET.Server
|
|
|
return 2;
|
|
|
}
|
|
|
|
|
|
+ communicator().waitForShutdown();
|
|
|
+ Log.Info("ice thread end");
|
|
|
return 0;
|
|
|
}
|
|
|
}
|