This commit is contained in:
aozhiwei 2022-03-17 14:43:57 +08:00
parent 845c847496
commit 72ae5463c3
5 changed files with 62 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include "entityfactory.h"
#include "perfmonitor.h"
#include "killmgr.h"
#include "httpproxy.h"
#include "ss_msgid.pb.h"
#include "ss_proto.pb.h"
@ -211,6 +212,7 @@ bool App::Init(int argc, char* argv[])
MapMgr::Instance()->Init();
PlayerMgr::Instance()->Init();
GGListener::Instance()->Init();
HttpProxy::Instance()->Init();
a8::UdpLog::Instance()->Info("gameserver starting instance_id:%d pid:%d debug_mode:%d channel:%d",
{
@ -243,6 +245,7 @@ bool App::Init(int argc, char* argv[])
void App::UnInit()
{
HttpProxy::Instance()->UnInit();
GGListener::Instance()->UnInit();
PlayerMgr::Instance()->UnInit();
MapMgr::Instance()->UnInit();

View File

@ -0,0 +1,23 @@
#include "precompile.h"
#include "httpproxy.h"
void HttpProxy::Init()
{
}
void HttpProxy::UnInit()
{
}
void HttpProxy::HttpGet(a8::XParams param,
f8::AsyncHttpOnOkFunc on_ok,
f8::AsyncHttpOnErrorFunc on_error,
const char* url,
a8::XObject url_params
)
{
}

View File

@ -0,0 +1,27 @@
#pragma once
#include "framework/cpp/httpclientpool.h"
class HttpProxy : public a8::Singleton<HttpProxy>
{
private:
HttpProxy() {};
friend class a8::Singleton<HttpProxy>;
public:
void Init();
void UnInit();
void HttpGet(a8::XParams param,
f8::AsyncHttpOnOkFunc on_ok,
f8::AsyncHttpOnErrorFunc on_error,
const char* url,
a8::XObject url_params
);
private:
std::map<std::string, a8::XParams> get_hash_;
};

View File

@ -24,6 +24,12 @@
const int ROOM_NUM_UP_LIMIT = 1000;
const int HUM_NUM_DOWN_LIMIT = 2500;
struct JoinRequest
{
int socket_handle = 0;
cs::CMJoin msg;
};
static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times)
{
#if 1
@ -147,6 +153,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
MatchMgr::Instance()->_CMJoin(hdr, msg);
return;
}
int game_times = 0;
RoomType_e self_room_type = GetHumanRoomType(msg, game_times);
if (self_room_type < RT_OldBrid1) {

View File

@ -14,6 +14,7 @@ namespace MetaData
struct MapTplThing;
}
struct JoinRequest;
class GridService;
class MapService;
class MapInstance;
@ -109,4 +110,5 @@ class RoomMgr : public a8::Singleton<RoomMgr>
a8::TimerAttacher reportstate_timer_attacher_;
std::map<std::string, int> gm_hash_;
std::map<std::string, std::map<std::string, long long>> team_room_hash_;
std::map<std::string, JoinRequest*> join_request_hash_;
};