Comparison

net/resolvers/service.lua @ 9396:f57fc24aa0dd

net.resolvers.service: Fix sorting SRV record
author Kim Alvefur <zash@zash.se>
date Sun, 30 Sep 2018 12:51:34 +0200
parent 9395:794eda565c69
child 9397:e09ddd061ec4
comparison
equal deleted inserted replaced
9395:794eda565c69 9396:f57fc24aa0dd
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.priority > b.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();