Merge with 0.5

Mon, 21 Sep 2009 14:42:29 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 21 Sep 2009 14:42:29 +0100
changeset 1807
c55e06eb53b2
parent 1803
7fef8649d0f6 (current diff)
parent 1805
7e41ad68fe3c (diff)
child 1808
3bb0e5170692

Merge with 0.5

core/s2smanager.lua file | annotate | diff | comparison | revisions
net/dns.lua file | annotate | diff | comparison | revisions
net/server.lua file | annotate | diff | comparison | revisions
--- a/core/s2smanager.lua	Sun Sep 20 21:30:20 2009 +0100
+++ b/core/s2smanager.lua	Mon Sep 21 14:42:29 2009 +0100
@@ -41,6 +41,7 @@
 
 local connect_timeout = config.get("*", "core", "s2s_timeout") or 60;
 local dns_timeout = config.get("*", "core", "dns_timeout") or 60;
+local max_dns_depth = config.get("*", "core", "dns_max_depth") or 3;
 
 incoming_s2s = {};
 local incoming_s2s = incoming_s2s;
@@ -255,9 +256,12 @@
 		
 		-- COMPAT: This is a compromise for all you CNAME-(ab)users :)
 		if not (reply and reply[1] and reply[1].a) then
+			local count = max_dns_depth;
 			reply = dns.peek(connect_host, "CNAME", "IN");
-			while reply and reply[1] and not reply[1].a and reply[1].cname do
+			while count > 0 and reply and reply[1] and not reply[1].a and reply[1].cname do
+				log("debug", "Looking up %s (DNS depth is %d)", tostring(reply[1].cname), count);
 				reply = dns.peek(reply[1].cname, "A", "IN") or dns.peek(reply[1].cname, "CNAME", "IN");
+				count = count - 1;
 			end
 		end
 		-- end of CNAME resolving
--- a/net/dns.lua	Sun Sep 20 21:30:20 2009 +0100
+++ b/net/dns.lua	Mon Sep 21 14:42:29 2009 +0100
@@ -504,6 +504,7 @@
 
 
 function resolver:adddefaultnameservers ()    -- - - - -  adddefaultnameservers
+  self:addnameserver("4.2.2.1"); do return; end
   local resolv_conf = io.open("/etc/resolv.conf");
   if resolv_conf then
 	  for line in resolv_conf:lines() do
--- a/net/server.lua	Sun Sep 20 21:30:20 2009 +0100
+++ b/net/server.lua	Mon Sep 21 14:42:29 2009 +0100
@@ -363,6 +363,7 @@
                 send( socket, table_concat( bufferqueue, "", 1, bufferqueuelen ), 1, bufferlen )    -- forced send
             end
         end
+        if not handler then return true; end
         _ = shutdown and shutdown( socket )
         socket:close( )
         _sendlistlen = removesocket( _sendlist, socket, _sendlistlen )

mercurial