Commit 3c7b9082 authored by nanahira's avatar nanahira

more fix

parent 6a5fbe5c
Pipeline #16750 failed with stages
in 3 minutes and 29 seconds
......@@ -4373,14 +4373,15 @@ unsigned int DuelClient::LookupHost(char *host) {
}
bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
char resolved[100];
#ifdef _WIN32
PDNS_RECORD ret;
DNS_STATUS status = DnsQuery_UTF8(hostname, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &ret, NULL);
PDNS_RECORD ret;
DNS_STATUS status = DnsQuery_W(hostname, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &ret, NULL);
if(status != 0)
return false;
result->host = LookupHost(ret->Data.SRV.pNameTarget);
BufferIO::EncodeUTF8(ret->Data.SRV.pNameTarget, resolved);
result->port = ntohs(ret->Data.SRV.wPort);
return true;
DnsRecordListFree(ret, DnsFreeRecordListDeep);
#else
struct __res_state res;
int status = res_ninit(&res);
......@@ -4393,6 +4394,7 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
ns_msg nsMsg;
ns_rr rr;
ns_initparse(answer, status, &nsMsg);
bool found = false;
for (int i = 0; i < ns_msg_count(nsMsg, ns_s_an); i++) {
if (ns_parserr(&nsMsg, ns_s_an, i, &rr) < 0 || ns_rr_type(rr) != T_SRV)
continue;
......@@ -4405,11 +4407,13 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
// decompress domain name
if (dn_expand(ns_msg_base(nsMsg), ns_msg_end(nsMsg), ns_rr_rdata(rr) + 3 * NS_INT16SZ, resolved, sizeof(resolved)) < 0)
continue;
result->host = LookupHost(resolved);
return true;
found = true;
}
return false;
if(!found)
return false;
#endif
result->host = LookupHost(resolved);
return true;
}
HostResult DuelClient::ParseHost(char *hostname) {
......
......@@ -66,7 +66,7 @@ project "YGOPro"
filter {}
end
end
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" }
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32", "Dnsapi" }
filter "not action:vs*"
buildoptions { "-std=c++14", "-fno-rtti" }
filter "not system:windows"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment