From 98cbc0ea79ce5bea637f7bd7ebe94e698cd818a0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Apr 2013 23:14:07 +0200 Subject: event/TimeoutMonitor: eliminate support for periodic events No caller needs this. Fixes use-after-free after returning from Client::OnTimeout(). --- src/InotifyQueue.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/InotifyQueue.cxx') diff --git a/src/InotifyQueue.cxx b/src/InotifyQueue.cxx index 3212f95f9..419135dae 100644 --- a/src/InotifyQueue.cxx +++ b/src/InotifyQueue.cxx @@ -38,7 +38,7 @@ enum { INOTIFY_UPDATE_DELAY_S = 5, }; -bool +void InotifyQueue::OnTimeout() { unsigned id; @@ -47,17 +47,16 @@ InotifyQueue::OnTimeout() const char *uri_utf8 = queue.front().c_str(); id = update_enqueue(uri_utf8, false); - if (id == 0) + if (id == 0) { /* retry later */ - return true; + ScheduleSeconds(INOTIFY_UPDATE_DELAY_S); + return; + } g_debug("updating '%s' job=%u", uri_utf8, id); queue.pop_front(); } - - /* done, remove the timer event by returning false */ - return false; } static bool -- cgit v1.2.3