1
This commit is contained in:
parent
e9b56610ba
commit
fb441acc87
@ -14,11 +14,11 @@ endif()
|
||||
set(LIB_DIR "ubuntu20.04_g++-9")
|
||||
message(LIB_DIR: ${LIB_DIR} )
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DNDEBUG -DMAP3D -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEWBIE_ROOM=1")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DNDEBUG -DMAP3D -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEWBIE_ROOM=1 -DUSE_BOOST=1")
|
||||
if (${ASAN})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -DCXY -DSXY -DMAP3D -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEWBIE_ROOM=1 -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -DCXY -DSXY -DMAP3D -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEWBIE_ROOM=1 -fsanitize=address -fno-omit-frame-pointer -DUSE_BOOST=1")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -DCXY -DSXY -DMAP3D -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEWBIE_ROOM=1")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -DCXY -DSXY -DMAP3D -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEWBIE_ROOM=1 -DUSE_BOOST=1")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <a8/sysutils.h>
|
||||
#include <a8/mutable_xobject.h>
|
||||
#include <a8/awaiter.h>
|
||||
#include <a8/promise.h>
|
||||
|
||||
#include <f8/udplog.h>
|
||||
#include <f8/jsonhttprequest.h>
|
||||
@ -22,6 +24,27 @@ struct HttpProxyRequest
|
||||
long long add_tick = 0;
|
||||
};
|
||||
|
||||
class HttpProxyPromise : public a8::Promise
|
||||
{
|
||||
public:
|
||||
|
||||
HttpProxyPromise(const char* url, a8::XObject url_params)
|
||||
{
|
||||
url_ = url;
|
||||
url_params_ = url_params;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void DoAwait() override
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
std::string url_;
|
||||
a8::XObject url_params_;
|
||||
};
|
||||
|
||||
static void _ProxyCallback(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@ -138,3 +161,9 @@ void HttpProxy::DestoryRequest(std::shared_ptr<HttpProxyRequest> request)
|
||||
{
|
||||
request_hash_.erase(request->req_id);
|
||||
}
|
||||
|
||||
std::shared_ptr<a8::Awaiter> HttpProxy::CoHttpGet(const char* url,
|
||||
a8::XObject url_params)
|
||||
{
|
||||
return std::make_shared<HttpProxyPromise>(url, url_params);
|
||||
}
|
||||
|
@ -4,6 +4,11 @@
|
||||
|
||||
#include "f8/httpclientpool.h"
|
||||
|
||||
namespace a8
|
||||
{
|
||||
class Awaiter;
|
||||
}
|
||||
|
||||
struct HttpProxyRequest;
|
||||
class HttpProxy : public a8::Singleton<HttpProxy>
|
||||
{
|
||||
@ -25,6 +30,9 @@ class HttpProxy : public a8::Singleton<HttpProxy>
|
||||
std::shared_ptr<HttpProxyRequest> GetRequest(const std::string& req_id);
|
||||
void DestoryRequest(std::shared_ptr<HttpProxyRequest> request);
|
||||
|
||||
std::shared_ptr<a8::Awaiter> CoHttpGet(const char* url,
|
||||
a8::XObject url_params);
|
||||
|
||||
private:
|
||||
|
||||
std::string CreateRequestId();
|
||||
|
2
third_party/f8
vendored
2
third_party/f8
vendored
@ -1 +1 @@
|
||||
Subproject commit ff41657bdf42cc0e43e161f3b19ef52f842b182c
|
||||
Subproject commit 1a93316b3852e72c999331172e293083bb059fdb
|
Loading…
x
Reference in New Issue
Block a user