Changeset

4125:5cf13260edec

net.dns: Fix tostring() for SRV records
author Matthew Wild <mwild1@gmail.com>
date Fri, 21 Jan 2011 14:02:02 +0000
parents 4124:3761aa844d65
children 4126:5044698a9d90 4127:f80b7a92da67
files net/dns.lua
diffstat 1 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/net/dns.lua	Thu Jan 13 02:33:50 2011 +0500
+++ b/net/dns.lua	Fri Jan 21 14:02:02 2011 +0000
@@ -158,8 +158,6 @@
 
 resolver.timeout = default_timeout;
 
-local SRV_tostring;
-
 local function default_rr_tostring(rr)
 	local rr_val = rr.type and rr[rr.type:lower()];
 	if type(rr_val) ~= "string" then
@@ -170,8 +168,13 @@
 
 local special_tostrings = {
 	LOC = resolver.LOC_tostring;
-	MX = function (rr) return string.format('%2i %s', rr.pref, rr.mx); end;
-	SRV = SRV_tostring;
+	MX  = function (rr)
+		return string.format('%2i %s', rr.pref, rr.mx);
+	end;
+	SRV = function (rr)
+		local s = rr.srv;
+		return string.format('%5d %5d %5d %s', s.priority, s.weight, s.port, s.target);
+	end;
 };
 
 local rr_metatable = {};   -- - - - - - - - - - - - - - - - - - -  rr_metatable
@@ -475,12 +478,6 @@
 	rr.ptr = self:name();
 end
 
-function SRV_tostring(rr)    -- - - - - - - - - - - - - - - - - - SRV_tostring
-	local s = rr.srv;
-	return string.format( '%5d %5d %5d %s', s.priority, s.weight, s.port, s.target );
-end
-
-
 function resolver:TXT(rr)    -- - - - - - - - - - - - - - - - - - - - - -  TXT
 	rr.txt = self:sub (rr.rdlength);
 end