This commit is contained in:
aozhiwei 2024-04-05 15:52:45 +08:00
parent 573e381c4b
commit 5d45ddbdd9

View File

@ -101,7 +101,45 @@ void GSMgr::_SS_WSP_RequestTargetServer(f8::MsgHdr* hdr, const ss::SS_WSP_Reques
void GSMgr::_SS_WSP_HttpTunnelRequest(f8::MsgHdr* hdr, const ss::SS_WSP_HttpTunnelRequest& msg)
{
ss::SS_MS_HttpTunnelResponse rspmsg;
a8::XObject request;
request.ReadFromUrlQueryString(msg.query_str());
std::string team_uuid = request.At("team_uuid")->AsXValue().GetString();
std::shared_ptr<GSNode> node = GetNodeByTeamId(team_uuid);
#ifdef DEBUG
a8::XPrintf("SS_WSP_HttpTunnelRequest %s\n" , {f8::PbToJson(&msg)});
{
if (request.HasKey("server_id")) {
node = GetNodeByInstanceId(request.At("server_id")->AsXValue());
if (!node) {
rspmsg.set_error_code(1);
rspmsg.set_error_msg("cant alloc node1");
GGListener::Instance()->SendMsg(hdr->socket_handle, rspmsg);
return;
}
rspmsg.set_error_code(0);
rspmsg.set_error_msg("");
rspmsg.set_context_id(msg.context_id());
rspmsg.set_host(node->ip);
rspmsg.set_port(node->port);
GGListener::Instance()->SendMsg(hdr->socket_handle, rspmsg);
return;
}
}
#endif
if (!node) {
rspmsg.set_error_code(1);
rspmsg.set_error_msg("cant alloc node1");
GGListener::Instance()->SendMsg(hdr->socket_handle, rspmsg);
return;
}
rspmsg.set_error_code(0);
rspmsg.set_error_msg("");
rspmsg.set_context_id(msg.context_id());
rspmsg.set_host(node->ip);
rspmsg.set_port(node->port);
GGListener::Instance()->SendMsg(hdr->socket_handle, rspmsg);
}
void GSMgr::_SS_Ping(f8::MsgHdr* hdr, const ss::SS_Ping& msg)