aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ClientExpire.cxx3
-rw-r--r--src/ClientInternal.hxx2
-rw-r--r--src/InotifyQueue.cxx11
-rw-r--r--src/InotifyQueue.hxx2
-rw-r--r--src/StateFile.cxx3
-rw-r--r--src/StateFile.hxx2
-rw-r--r--src/event/TimeoutMonitor.cxx14
-rw-r--r--src/event/TimeoutMonitor.hxx7
8 files changed, 17 insertions, 27 deletions
diff --git a/src/ClientExpire.cxx b/src/ClientExpire.cxx
index 6bb0a43ae..e5f9a9867 100644
--- a/src/ClientExpire.cxx
+++ b/src/ClientExpire.cxx
@@ -30,7 +30,7 @@ Client::SetExpired()
TimeoutMonitor::Schedule(0);
}
-bool
+void
Client::OnTimeout()
{
if (!IsExpired()) {
@@ -39,5 +39,4 @@ Client::OnTimeout()
}
Close();
- return false;
}
diff --git a/src/ClientInternal.hxx b/src/ClientInternal.hxx
index c31118680..8dd839cc2 100644
--- a/src/ClientInternal.hxx
+++ b/src/ClientInternal.hxx
@@ -120,7 +120,7 @@ private:
virtual void OnSocketClosed() override;
/* virtual methods from class TimeoutMonitor */
- virtual bool OnTimeout() override;
+ virtual void OnTimeout() override;
};
extern int client_timeout;
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
diff --git a/src/InotifyQueue.hxx b/src/InotifyQueue.hxx
index 761df574a..818621ef8 100644
--- a/src/InotifyQueue.hxx
+++ b/src/InotifyQueue.hxx
@@ -35,7 +35,7 @@ public:
void Enqueue(const char *uri_utf8);
private:
- virtual bool OnTimeout() override;
+ virtual void OnTimeout() override;
};
#endif
diff --git a/src/StateFile.cxx b/src/StateFile.cxx
index ae782335d..73af1777c 100644
--- a/src/StateFile.cxx
+++ b/src/StateFile.cxx
@@ -116,9 +116,8 @@ StateFile::CheckModified()
ScheduleSeconds(2 * 60);
}
-bool
+void
StateFile::OnTimeout()
{
Write();
- return false;
}
diff --git a/src/StateFile.hxx b/src/StateFile.hxx
index 79693c70b..a97e4e2c3 100644
--- a/src/StateFile.hxx
+++ b/src/StateFile.hxx
@@ -67,7 +67,7 @@ private:
bool IsModified() const;
/* virtual methods from TimeoutMonitor */
- virtual bool OnTimeout() override;
+ virtual void OnTimeout() override;
};
#endif /* STATE_FILE_H */
diff --git a/src/event/TimeoutMonitor.cxx b/src/event/TimeoutMonitor.cxx
index e0bf997a0..8636292ac 100644
--- a/src/event/TimeoutMonitor.cxx
+++ b/src/event/TimeoutMonitor.cxx
@@ -45,21 +45,17 @@ TimeoutMonitor::ScheduleSeconds(unsigned s)
source = loop.AddTimeoutSeconds(s, Callback, this);
}
-bool
+void
TimeoutMonitor::Run()
{
- bool result = OnTimeout();
- if (!result && source != nullptr) {
- g_source_unref(source);
- source = nullptr;
- }
-
- return result;
+ Cancel();
+ OnTimeout();
}
gboolean
TimeoutMonitor::Callback(gpointer data)
{
TimeoutMonitor &monitor = *(TimeoutMonitor *)data;
- return monitor.Run();
+ monitor.Run();
+ return false;
}
diff --git a/src/event/TimeoutMonitor.hxx b/src/event/TimeoutMonitor.hxx
index 6914bcb61..4ebc6b644 100644
--- a/src/event/TimeoutMonitor.hxx
+++ b/src/event/TimeoutMonitor.hxx
@@ -47,13 +47,10 @@ public:
void Cancel();
protected:
- /**
- * @return true reschedules the timeout again
- */
- virtual bool OnTimeout() = 0;
+ virtual void OnTimeout() = 0;
private:
- bool Run();
+ void Run();
static gboolean Callback(gpointer data);
};