aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/dns.lua1
-rw-r--r--net/httpserver.lua1
-rw-r--r--net/server_event.lua9
-rw-r--r--net/server_select.lua22
-rw-r--r--net/xmppcomponent_listener.lua2
-rw-r--r--net/xmppserver_listener.lua4
6 files changed, 21 insertions, 18 deletions
diff --git a/net/dns.lua b/net/dns.lua
index 8f428476..5b32a56c 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -358,6 +358,7 @@ function resolver:name() -- - - - - - - - - - - - - - - - - - - - - - name
local remember, pointers = nil, 0;
local len = self:byte();
local n = {};
+ if len == 0 then return "." end -- Root label
while len > 0 do
if len >= 0xc0 then -- name is "compressed"
pointers = pointers + 1;
diff --git a/net/httpserver.lua b/net/httpserver.lua
index 74f61c56..44e8e24d 100644
--- a/net/httpserver.lua
+++ b/net/httpserver.lua
@@ -7,7 +7,6 @@
--
-local server = require "net.server"
local url_parse = require "socket.url".parse;
local httpstream_new = require "util.httpstream".new;
diff --git a/net/server_event.lua b/net/server_event.lua
index f4745c34..dbf5161f 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -295,7 +295,10 @@ do
end
function interface_mt:resume()
- return self:_lock(self.nointerface, false, self.nowriting);
+ self:_lock(self.nointerface, false, self.nowriting);
+ if not self.eventread then
+ self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback
+ end
end
function interface_mt:counter(c)
@@ -642,6 +645,10 @@ do
return -1
end
end
+ if interface.noreading then
+ interface.eventread = nil;
+ return -1;
+ end
return EV_READ, cfg.READ_TIMEOUT
end
end
diff --git a/net/server_select.lua b/net/server_select.lua
index 412d03c0..8802f620 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -596,25 +596,23 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
handler.sendbuffer = handshake
handshake( socket ) -- do handshake
end
- handler.readbuffer = _readbuffer
- handler.sendbuffer = _sendbuffer
-
- if sslctx then
- out_put "server.lua: auto-starting ssl negotiation..."
- handler.autostart_ssl = true;
- handler:starttls(sslctx);
- end
-
- else
- handler.readbuffer = _readbuffer
- handler.sendbuffer = _sendbuffer
end
+
+ handler.readbuffer = _readbuffer
+ handler.sendbuffer = _sendbuffer
send = socket.send
receive = socket.receive
shutdown = ( ssl and id ) or socket.shutdown
_socketlist[ socket ] = handler
_readlistlen = addsocket(_readlist, socket, _readlistlen)
+
+ if sslctx and luasec then
+ out_put "server.lua: auto-starting ssl negotiation..."
+ handler.autostart_ssl = true;
+ handler:starttls(sslctx);
+ end
+
return handler, socket
end
diff --git a/net/xmppcomponent_listener.lua b/net/xmppcomponent_listener.lua
index 90293559..dd7b2b91 100644
--- a/net/xmppcomponent_listener.lua
+++ b/net/xmppcomponent_listener.lua
@@ -7,8 +7,6 @@
--
-local hosts = _G.hosts;
-
local t_concat = table.concat;
local tostring = tostring;
local type = type;
diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua
index 3af0b962..a92b1a7f 100644
--- a/net/xmppserver_listener.lua
+++ b/net/xmppserver_listener.lua
@@ -66,7 +66,7 @@ function stream_callbacks.handlestanza(session, stanza)
end
local sessions = {};
-local xmppserver = { default_port = 5269, default_mode = "*a" };
+local xmppserver = { default_port = 5269, default_mode = "*a", default_interface = "*" };
-- These are session methods --
@@ -178,7 +178,7 @@ end
function xmppserver.ondisconnect(conn, err)
local session = sessions[conn];
if session then
- if err and err ~= "closed" and session.srv_hosts then
+ if err and err ~= "closed" then
(session.log or log)("debug", "s2s connection attempt failed: %s", err);
if s2s_attempt_connect(session, err) then
(session.log or log)("debug", "...so we're going to try another target");