This could happen if the network routes are not yet setup
so the sendto() could fail. In this case try next address and
hope for the best. This is a rare issue but I have seen it
couple of times.
---
 src/ntp.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ntp.c b/src/ntp.c
index 91a8832..8c31fdb 100644
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -100,7 +100,12 @@ static void send_packet(int fd, const char *server)
        len = sendto(fd, &msg, sizeof(msg), MSG_DONTWAIT,
                                                &addr, sizeof(addr));
        if (len < 0) {
-               connman_error("Time request for server %s failed", server);
+               connman_error("Time request for server %s failed (%d/%s)",
+                       server, errno, strerror(errno));
+
+               if (errno == ENETUNREACH)
+                       __connman_timeserver_sync_next();
+
                return;
        }
 
-- 
1.7.9.5

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to