Changeset

7042:20ac6972b9aa

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Sat, 02 Jan 2016 20:42:53 +0000
parents 7038:22f36a3d6369 (current diff) 7041:aff786e7b4ce (diff)
children 7046:6b4232125f32
files net/server_event.lua net/server_select.lua
diffstat 3 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_event.lua	Fri Jan 01 23:31:13 2016 +0100
+++ b/net/server_event.lua	Sat Jan 02 20:42:53 2016 +0000
@@ -614,6 +614,7 @@
 	local interface = {
 		_connections = 0;
 
+		type = "server";
 		conn = server;
 		onconnect = listener.onconnect;  -- will be called when new client connected
 		eventread = false;  -- read event handler
--- a/net/server_select.lua	Fri Jan 01 23:31:13 2016 +0100
+++ b/net/server_select.lua	Sat Jan 02 20:42:53 2016 +0000
@@ -934,6 +934,7 @@
 		end
 	until quitting;
 	if once and quitting == "once" then quitting = nil; return; end
+	closeall();
 	return "quitting"
 end
 
--- a/util/events.lua	Fri Jan 01 23:31:13 2016 +0100
+++ b/util/events.lua	Sat Jan 02 20:42:53 2016 +0000
@@ -17,10 +17,15 @@
 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