1
This commit is contained in:
parent
2702692b31
commit
b4a74c4bd9
@ -9,6 +9,7 @@
|
|||||||
#include <f8/netmsghandler.h>
|
#include <f8/netmsghandler.h>
|
||||||
#include <f8/protoutils.h>
|
#include <f8/protoutils.h>
|
||||||
#include <f8/jsonhttprequest.h>
|
#include <f8/jsonhttprequest.h>
|
||||||
|
#include <f8/utils.h>
|
||||||
|
|
||||||
#include "mastermgr.h"
|
#include "mastermgr.h"
|
||||||
#include "master.h"
|
#include "master.h"
|
||||||
@ -107,17 +108,11 @@ void MasterMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr* hdr, const ss::SS_MS_Res
|
|||||||
|
|
||||||
void MasterMgr::_SS_MS_HttpTunnelResponse(f8::MsgHdr* hdr, const ss::SS_MS_HttpTunnelResponse& msg)
|
void MasterMgr::_SS_MS_HttpTunnelResponse(f8::MsgHdr* hdr, const ss::SS_MS_HttpTunnelResponse& msg)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
a8::XPrintf("SS_MS_HttpTunnelResponse %s\n" , {f8::PbToJson(&msg)});
|
||||||
|
#endif
|
||||||
auto req = GetHttpTunnelRequestByContextId(msg.context_id());
|
auto req = GetHttpTunnelRequestByContextId(msg.context_id());
|
||||||
if (req) {
|
if (req) {
|
||||||
#ifdef DEBUG
|
|
||||||
a8::XPrintf("httpTunnel error_code:%d error_msg:%s host:%s port:%d\n",
|
|
||||||
{
|
|
||||||
msg.error_code(),
|
|
||||||
msg.error_msg(),
|
|
||||||
msg.host(),
|
|
||||||
msg.port()
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
if (msg.error_code() == 0) {
|
if (msg.error_code() == 0) {
|
||||||
std::weak_ptr<UpStream> conn = UpStreamMgr::Instance()->RecreateUpStream
|
std::weak_ptr<UpStream> conn = UpStreamMgr::Instance()->RecreateUpStream
|
||||||
(
|
(
|
||||||
@ -125,12 +120,14 @@ void MasterMgr::_SS_MS_HttpTunnelResponse(f8::MsgHdr* hdr, const ss::SS_MS_HttpT
|
|||||||
msg.port()
|
msg.port()
|
||||||
);
|
);
|
||||||
if (!conn.expired()) {
|
if (!conn.expired()) {
|
||||||
ss::SS_HttpTunnelRequest msg;
|
ss::SS_HttpTunnelRequest upmsg;
|
||||||
msg.set_context_id(msg.context_id());
|
upmsg.set_context_id(msg.context_id());
|
||||||
msg.set_socket_handle(msg.socket_handle());
|
upmsg.set_socket_handle(req->socket_handle);
|
||||||
msg.set_url(msg.url());
|
upmsg.set_url(req->request->GetUrl());
|
||||||
msg.set_query_str(msg.query_str());
|
std::string query_str;
|
||||||
conn.lock()->SendMsg(req->socket_handle, msg);
|
req->request->GetParams()->ToUrlEncodeStr(query_str);
|
||||||
|
upmsg.set_query_str(query_str);
|
||||||
|
conn.lock()->SendMsg(req->socket_handle, upmsg);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
abort();
|
abort();
|
||||||
@ -149,8 +146,14 @@ void MasterMgr::_SS_MS_HttpTunnelResponse(f8::MsgHdr* hdr, const ss::SS_MS_HttpT
|
|||||||
|
|
||||||
void MasterMgr::_SS_HttpTunnelResponse(f8::MsgHdr* hdr, const ss::SS_HttpTunnelResponse& msg)
|
void MasterMgr::_SS_HttpTunnelResponse(f8::MsgHdr* hdr, const ss::SS_HttpTunnelResponse& msg)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
a8::XPrintf("SS_HttpTunnelResponse %s\n" , {f8::PbToJson(&msg)});
|
||||||
|
#endif
|
||||||
auto req = GetHttpTunnelRequestByContextId(msg.context_id());
|
auto req = GetHttpTunnelRequestByContextId(msg.context_id());
|
||||||
if (req) {
|
if (req) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
a8::XPrintf("SS_HttpTunnelResponse2 %s\n" , {f8::PbToJson(&msg)});
|
||||||
|
#endif
|
||||||
req->request->GetResp()->ReadFromJsonString(msg.response());
|
req->request->GetResp()->ReadFromJsonString(msg.response());
|
||||||
req->request->Response();
|
req->request->Response();
|
||||||
if (!req->timer_wp.expired()) {
|
if (!req->timer_wp.expired()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user