Changeset View
Changeset View
Standalone View
Standalone View
source/network/StunClient.cpp
Show First 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | JS::Value StunClient::FindStunEndpointHost(const ScriptInterface& scriptInterface, int port) | ||||
ENetAddress addr; | ENetAddress addr; | ||||
addr.host = ntohl(m_IP); | addr.host = ntohl(m_IP); | ||||
enet_address_get_host_ip(&addr, ipStr, ARRAY_SIZE(ipStr)); | enet_address_get_host_ip(&addr, ipStr, ARRAY_SIZE(ipStr)); | ||||
JSContext* cx = scriptInterface.GetContext(); | JSContext* cx = scriptInterface.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
JS::RootedValue stunEndpoint(cx); | JS::RootedValue stunEndpoint(cx); | ||||
scriptInterface.CreateObject(&stunEndpoint, "ip", CStr(ipStr), "port", m_Port); | ScriptInterface::CreateObject(cx, &stunEndpoint, "ip", ipStr, "port", m_Port); | ||||
return stunEndpoint; | return stunEndpoint; | ||||
} | } | ||||
bool StunClient::FindStunEndpointJoin(ENetHost& transactionHost, StunClient::StunEndpoint& stunEndpoint) | bool StunClient::FindStunEndpointJoin(ENetHost& transactionHost, StunClient::StunEndpoint& stunEndpoint) | ||||
{ | { | ||||
if (!STUNRequestAndResponse(transactionHost)) | if (!STUNRequestAndResponse(transactionHost)) | ||||
return false; | return false; | ||||
Show All 29 Lines |
Wildfire Games · Phabricator