Software /
code /
prosody
Comparison
net/server_event.lua @ 4399:1b4161970842
net.server_event, net.server_select: Fixed some global pollution.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 14 Oct 2011 00:46:29 +0500 |
parent | 4377:705a8f14427b |
child | 4468:938d878d8087 |
comparison
equal
deleted
inserted
replaced
4398:acc37e221940 | 4399:1b4161970842 |
---|---|
825 closeallservers(); | 825 closeallservers(); |
826 base:loopexit(); | 826 base:loopexit(); |
827 end | 827 end |
828 end | 828 end |
829 | 829 |
830 function get_backend() | 830 local function get_backend() |
831 return base:method(); | 831 return base:method(); |
832 end | 832 end |
833 | 833 |
834 -- We need to hold onto the events to stop them | 834 -- We need to hold onto the events to stop them |
835 -- being garbage-collected | 835 -- being garbage-collected |
836 local signal_events = {}; -- [signal_num] -> event object | 836 local signal_events = {}; -- [signal_num] -> event object |
837 function hook_signal(signal_num, handler) | 837 local function hook_signal(signal_num, handler) |
838 local function _handler(event) | 838 local function _handler(event) |
839 local ret = handler(); | 839 local ret = handler(); |
840 if ret ~= false then -- Continue handling this signal? | 840 if ret ~= false then -- Continue handling this signal? |
841 return EV_SIGNAL; -- Yes | 841 return EV_SIGNAL; -- Yes |
842 end | 842 end |