Blob Blame History Raw
From 1e673f08f3299f4704e26cb983f046091881dc01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 15 Jul 2014 09:52:17 -0400
Subject: [PATCH] timesyncd: only listen to clock changes when connected

This reverts previous commit and applies a different fix.

manager_clock_watch() callback calls manager_send_request() to kick
off a resync. We can only do that when we're actually connected to
something. It is not useful to setup the callback from manager_new().

Now the callback will be dropped in manager_connect() and requested
in manager_begin().

https://bugs.freedesktop.org/show_bug.cgi?id=80932
(cherry picked from commit c566ee3253132cc2ec37ed04c5bccbadf8e60c58)
---
 src/timesync/timesyncd.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
index 9bc773ce5f..19af9f9b61 100644
--- a/src/timesync/timesyncd.c
+++ b/src/timesync/timesyncd.c
@@ -331,9 +331,6 @@ static int manager_clock_watch(sd_event_source *source, int fd, uint32_t revents
         /* rearm timer */
         manager_clock_watch_setup(m);
 
-        if (!m->current_server_address)
-                return 0;
-
         /* skip our own jumps */
         if (m->jumped) {
                 m->jumped = false;
@@ -1047,10 +1044,6 @@ static int manager_new(Manager **ret) {
         if (r < 0)
                 return r;
 
-        r = manager_clock_watch_setup(m);
-        if (r < 0)
-                return r;
-
         *ret = m;
         m = NULL;