Software /
code /
prosody
Changeset
2964:49b5c87d2fa0
util.timer: When using libevent hold onto the event handle to stop it being collected (and the timer stopping). Fixes BOSH ghosts, thanks Flo, niekie, waqas.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 07 Apr 2010 21:00:20 +0100 |
parents | 2961:db3c0ecce3f4 |
children | 2965:0fe9cfaeaed7 2968:fdd049a4e551 |
files | util/timer.lua |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/timer.lua Sat Apr 03 23:09:11 2010 +0100 +++ b/util/timer.lua Wed Apr 07 21:00:20 2010 +0100 @@ -55,11 +55,12 @@ else local EVENT_LEAVE = (event.core and event.core.LEAVE) or -1; function _add_task(delay, func) - event_base:addevent(nil, 0, function () + local event_handle; + event_handle = event_base:addevent(nil, 0, function () local ret = func(); if ret then return 0, ret; - else + elseif event_handle then return EVENT_LEAVE; end end