util/adminstream.lua
branch0.12
changeset 12397 6966026262f4
parent 12396 5373724e08a5
child 12856 c35afa353f8f
equal deleted inserted replaced
12396:5373724e08a5 12397:6966026262f4
   138 --- Public methods
   138 --- Public methods
   139 
   139 
   140 local function new_connection(socket_path, listeners)
   140 local function new_connection(socket_path, listeners)
   141 	local have_unix, unix = pcall(require, "socket.unix");
   141 	local have_unix, unix = pcall(require, "socket.unix");
   142 	if have_unix and type(unix) == "function" then
   142 	if have_unix and type(unix) == "function" then
       
   143 		-- COMPAT #1717
       
   144 		-- Before the introduction of datagram support, only the stream socket
       
   145 		-- constructor was exported instead of a module table. Due to the lack of a
       
   146 		-- proper release of LuaSocket, distros have settled on shipping either the
       
   147 		-- last RC tag or some commit since then.
       
   148 		-- Here we accomodate both variants.
   143 		unix = { stream = unix };
   149 		unix = { stream = unix };
   144 	end
   150 	end
   145 	if type(unix) ~= "table" then
   151 	if type(unix) ~= "table" then
   146 		have_unix = false;
   152 		have_unix = false;
   147 	end
   153 	end