You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
4.1 KiB
167 lines
4.1 KiB
/*
|
|
Sog 游戏基础库
|
|
2016 by zouwei
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.IO;
|
|
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
using Sog.IO;
|
|
|
|
namespace Version
|
|
{
|
|
public class GmCmdSvc : BaseReloadableService
|
|
{
|
|
public override int GetServiceType()
|
|
{
|
|
return VersionServiceType.GmCmdSvc;
|
|
}
|
|
|
|
//销毁的时候清空指令注册
|
|
public override void Dispose()
|
|
{
|
|
GmCommandMgr.Instance.ClearAll();
|
|
}
|
|
|
|
//构造的时候注册所有指令
|
|
public GmCmdSvc()
|
|
{
|
|
RegisterAllGmCmd();
|
|
}
|
|
|
|
private void RegisterAllGmCmd()
|
|
{
|
|
GmCommandMgr.Instance.Register("TestVersionReq", "TestVersionReq appVersion apkVersion os channel", TestVersionReq);
|
|
|
|
GmCommandMgr.Instance.Register("DeadLoop", "DeadLoop", DeadLoop);
|
|
}
|
|
|
|
|
|
private int TestVersionReq(long userid, string[] cmdParams)
|
|
{
|
|
TraceLog.Debug("GmCmdSvc.TestVersionReq begin");
|
|
|
|
if (cmdParams.Length != 4)
|
|
{
|
|
TraceLog.Error("GmCmdSvc.SetAccountGateUrl invalid param,need appVersion apkVersion os channel");
|
|
return -1;
|
|
}
|
|
|
|
string appVersion = cmdParams[0];
|
|
string apkVersion = cmdParams[1];
|
|
string os = cmdParams[2];
|
|
string channel = cmdParams[3];
|
|
|
|
|
|
CSVersionCheckReq req = new CSVersionCheckReq();
|
|
|
|
req.Version.AppVersion.SetString(appVersion);
|
|
if(channel != "en")
|
|
req.Version.ApkChannel.SetString(channel);
|
|
req.Version.Os.SetString(os);
|
|
req.ApkVersion.SetString(apkVersion);
|
|
|
|
|
|
ClientConnectInfo clientInfo = new ClientConnectInfo();
|
|
clientInfo.iConnectSessionID = 0;
|
|
clientInfo.ip = "127.0.0.1";
|
|
|
|
VersionCheckReqHandler.ProcessVersionReq(0, clientInfo, ref req);
|
|
|
|
|
|
TraceLog.Debug("GmCmdSvc.TestVersionReq {0} {1} {2} {3}"
|
|
, appVersion, apkVersion, os, channel);
|
|
|
|
return 0;
|
|
}
|
|
|
|
private int DeadLoop(long userid, string[] cmdParams)
|
|
{
|
|
TraceLog.Debug("GmCmdSvc.TestVersionReq begin");
|
|
|
|
Task task1 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task2 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task3 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task4 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task5 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task6 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task7 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task8 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task9 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task10 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task11 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task12 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task13 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
Task task14 = Task.Run(() =>
|
|
{
|
|
DeadLoopFun();
|
|
});
|
|
|
|
return 0;
|
|
}
|
|
|
|
private static void DeadLoopFun()
|
|
{
|
|
long i = 0;
|
|
while(true)
|
|
{
|
|
i++;
|
|
i = i * 5 + 6 / 8;
|
|
i += 333;
|
|
i -= 123;
|
|
i--;
|
|
|
|
if(i == 1234567890)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
TraceLog.Debug("GmCmdSvc.DeadLoopFun");
|
|
}
|
|
}
|
|
}
|
|
|