Commit 1ce780fb authored by nanahira's avatar nanahira

implement priority check

parent 171b8014
Pipeline #16753 failed with stages
in 3 minutes and 56 seconds
...@@ -4393,11 +4393,16 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) { ...@@ -4393,11 +4393,16 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
ns_initparse(answer, status, &nsMsg); ns_initparse(answer, status, &nsMsg);
bool found = false; bool found = false;
std::vector<RetrivedSRVRecord> records; std::vector<RetrivedSRVRecord> records;
unsigned short minPriority = 0xffff;
for(int i = 0; i < ns_msg_count(nsMsg, ns_s_an); i++) { for(int i = 0; i < ns_msg_count(nsMsg, ns_s_an); i++) {
auto record = RetrivedSRVRecord(nsMsg, i); auto record = RetrivedSRVRecord(nsMsg, i);
if(!record.valid) if(!record.valid || record.priority > minPriority)
continue; continue;
for (int j = 0; j < record.weight; ++j) { for (int j = 0; j < record.weight; ++j) {
if(record.priority < minPriority) {
records.clear();
minPriority = record.priority;
}
records.push_back(record); records.push_back(record);
} }
} }
......
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