This repository has been archived on 2024-03-29. You can view files and clone it, but cannot push or open issues or pull requests.
FreeSR/FreeSR.Dispatch/Handlers/QueryDispatchHandler.cs

37 lines
1.3 KiB
C#
Raw Normal View History

2024-01-27 13:06:07 +00:00
namespace FreeSR.Dispatch.Handlers
{
using Ceen;
using FreeSR.Dispatch.Service.Manager;
using FreeSR.Dispatch.Util;
using FreeSR.Proto;
using NLog;
using System.Threading.Tasks;
internal class QueryDispatchHandler : IHttpModule
{
private static readonly Logger s_log = LogManager.GetCurrentClassLogger();
public async Task<bool> HandleAsync(IHttpContext context)
{
var query = context.Request.QueryString;
var version = query["version"];
var timestamp = query["t"];
var languageType = query["language_type"];
var platformType = query["platform_type"];
s_log.Info($"query_dispatch: version: {version}, time: {timestamp}, language: {languageType}, platform: {platformType}");
context.Response.StatusCode = HttpStatusCode.OK;
context.Response.ContentType = "text/plain";
2024-01-27 13:08:24 +00:00
await context.Response.WriteAllAsync(Convert.ToBase64String(ProtobufUtil.Serialize(new RegionList
2024-01-27 13:06:07 +00:00
{
2024-02-21 06:41:22 +00:00
Retcode = 0,
2024-01-27 13:08:24 +00:00
TopServerRegionName = RegionManager.GetTopServerRegionName(),
RegionInfoLists = { RegionManager.GetRegionList() }
2024-01-27 13:06:07 +00:00
})));
return true;
}
}
}