aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2016-01-02 20:42:53 +0000
committerMatthew Wild <mwild1@gmail.com>2016-01-02 20:42:53 +0000
commit8525a177737252f17ef63a09047b9bbac7f61282 (patch)
treecb3e8bce329accde5bcfa6c8138f4868a7aa9c58
parent93408770ef53ce0056d7a875f79b053f218eb806 (diff)
parent1eb8d252ea82a641caaf4996d1a9c31f62db83a2 (diff)
downloadprosody-8525a177737252f17ef63a09047b9bbac7f61282.tar.gz
prosody-8525a177737252f17ef63a09047b9bbac7f61282.zip
Merge 0.10->trunk
-rw-r--r--net/server_event.lua1
-rw-r--r--net/server_select.lua1
-rw-r--r--util/events.lua5
3 files changed, 7 insertions, 0 deletions
diff --git a/net/server_event.lua b/net/server_event.lua
index 9b1ffb25..67758664 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -614,6 +614,7 @@ local function handleserver( server, addr, port, pattern, listener, sslctx ) --
local interface = {
_connections = 0;
+ type = "server";
conn = server;
onconnect = listener.onconnect; -- will be called when new client connected
eventread = false; -- read event handler
diff --git a/net/server_select.lua b/net/server_select.lua
index 35dcb5a7..ced73074 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -934,6 +934,7 @@ loop = function(once) -- this is the main loop of the program
end
until quitting;
if once and quitting == "once" then quitting = nil; return; end
+ closeall();
return "quitting"
end
diff --git a/util/events.lua b/util/events.lua
index 825ffb19..073d2a60 100644
--- a/util/events.lua
+++ b/util/events.lua
@@ -17,10 +17,15 @@ local next = next;
local _ENV = nil;
local function new()
+ -- Map event name to ordered list of handlers (lazily built): handlers[event_name] = array_of_handler_functions
local handlers = {};
+ -- Array of wrapper functions that wrap all events (nil if empty)
local global_wrappers;
+ -- Per-event wrappers: wrappers[event_name] = wrapper_function
local wrappers = {};
+ -- Event map: event_map[handler_function] = priority_number
local event_map = {};
+ -- Called on-demand to build handlers entries
local function _rebuild_index(handlers, event)
local _handlers = event_map[event];
if not _handlers or next(_handlers) == nil then return; end