1
This commit is contained in:
parent
2702692b31
commit
b4a74c4bd9
@ -9,6 +9,7 @@
|
||||
#include <f8/netmsghandler.h>
|
||||
#include <f8/protoutils.h>
|
||||
#include <f8/jsonhttprequest.h>
|
||||
#include <f8/utils.h>
|
||||
|
||||
#include "mastermgr.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)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("SS_MS_HttpTunnelResponse %s\n" , {f8::PbToJson(&msg)});
|
||||
#endif
|
||||
auto req = GetHttpTunnelRequestByContextId(msg.context_id());
|
||||
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) {
|
||||
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()
|
||||
);
|
||||
if (!conn.expired()) {
|
||||
ss::SS_HttpTunnelRequest msg;
|
||||
msg.set_context_id(msg.context_id());
|
||||
msg.set_socket_handle(msg.socket_handle());
|
||||
msg.set_url(msg.url());
|
||||
msg.set_query_str(msg.query_str());
|
||||
conn.lock()->SendMsg(req->socket_handle, msg);
|
||||
ss::SS_HttpTunnelRequest upmsg;
|
||||
upmsg.set_context_id(msg.context_id());
|
||||
upmsg.set_socket_handle(req->socket_handle);
|
||||
upmsg.set_url(req->request->GetUrl());
|
||||
std::string query_str;
|
||||
req->request->GetParams()->ToUrlEncodeStr(query_str);
|
||||
upmsg.set_query_str(query_str);
|
||||
conn.lock()->SendMsg(req->socket_handle, upmsg);
|
||||
return;
|
||||
} else {
|
||||
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)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("SS_HttpTunnelResponse %s\n" , {f8::PbToJson(&msg)});
|
||||
#endif
|
||||
auto req = GetHttpTunnelRequestByContextId(msg.context_id());
|
||||
if (req) {
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("SS_HttpTunnelResponse2 %s\n" , {f8::PbToJson(&msg)});
|
||||
#endif
|
||||
req->request->GetResp()->ReadFromJsonString(msg.response());
|
||||
req->request->Response();
|
||||
if (!req->timer_wp.expired()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user