Comparison

net/resolvers/service.lua @ 9397:e09ddd061ec4

net.resolvers.service: Sort SRV records in correct direction
author Kim Alvefur <zash@zash.se>
date Sun, 30 Sep 2018 13:02:46 +0200
parent 9396:f57fc24aa0dd
child 9691:e11e076f0eb8
child 10384:94c9c574cd8a
comparison
equal deleted inserted replaced
9396:f57fc24aa0dd 9397:e09ddd061ec4
45 if #answer == 1 and answer[1].srv.target == "." then -- No service here 45 if #answer == 1 and answer[1].srv.target == "." then -- No service here
46 ready(); 46 ready();
47 return; 47 return;
48 end 48 end
49 49
50 table.sort(answer, function (a, b) return a.srv.priority > b.srv.priority end); 50 table.sort(answer, function (a, b) return a.srv.priority < b.srv.priority end);
51 for _, record in ipairs(answer) do 51 for _, record in ipairs(answer) do
52 table.insert(targets, { record.srv.target, record.srv.port, self.conn_type, self.extra }); 52 table.insert(targets, { record.srv.target, record.srv.port, self.conn_type, self.extra });
53 end 53 end
54 end 54 end
55 ready(); 55 ready();