diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-07-14 18:29:27 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-07-15 09:53:18 -0400 |
commit | ae2db4e7e868fb89f5053a962a3a43337ddfd4e0 (patch) | |
tree | e5d2f55ac0f3dafbeade700ecb83191b0bf660d0 /src/timesync | |
parent | c566ee3253132cc2ec37ed04c5bccbadf8e60c58 (diff) |
timesyncd: add sockaddr_pretty wrapper
Diffstat (limited to 'src/timesync')
-rw-r--r-- | src/timesync/timesyncd.c | 6 | ||||
-rw-r--r-- | src/timesync/timesyncd.h | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c index e15588d1cf..78ef5f72a1 100644 --- a/src/timesync/timesyncd.c +++ b/src/timesync/timesyncd.c @@ -210,7 +210,7 @@ static int manager_timeout(sd_event_source *source, usec_t usec, void *userdata) assert(m->current_server_name); assert(m->current_server_address); - sockaddr_pretty(&m->current_server_address->sockaddr.sa, m->current_server_address->socklen, true, &pretty); + server_address_pretty(m->current_server_address, &pretty); log_info("Timed out waiting for reply from %s (%s).", strna(pretty), m->current_server_name->string); return manager_connect(m); @@ -250,7 +250,7 @@ static int manager_send_request(Manager *m) { ntpmsg.trans_time.sec = htobe32(m->trans_time.tv_sec + OFFSET_1900_1970); ntpmsg.trans_time.frac = htobe32(m->trans_time.tv_nsec); - sockaddr_pretty(&m->current_server_address->sockaddr.sa, m->current_server_address->socklen, true, &pretty); + server_address_pretty(m->current_server_address, &pretty); len = sendto(m->server_socket, &ntpmsg, sizeof(ntpmsg), MSG_DONTWAIT, &m->current_server_address->sockaddr.sa, m->current_server_address->socklen); if (len == sizeof(ntpmsg)) { @@ -782,7 +782,7 @@ static int manager_begin(Manager *m) { m->poll_interval_usec = NTP_POLL_INTERVAL_MIN_SEC * USEC_PER_SEC; - sockaddr_pretty(&m->current_server_address->sockaddr.sa, m->current_server_address->socklen, true, &pretty); + server_address_pretty(m->current_server_address, &pretty); log_info("Using NTP server %s (%s).", strna(pretty), m->current_server_name->string); sd_notifyf(false, "STATUS=Using Time Server %s (%s).", strna(pretty), m->current_server_name->string); diff --git a/src/timesync/timesyncd.h b/src/timesync/timesyncd.h index 4afe4b9f5b..52cca6d1ed 100644 --- a/src/timesync/timesyncd.h +++ b/src/timesync/timesyncd.h @@ -42,6 +42,10 @@ struct ServerName { LIST_FIELDS(ServerName, names); }; +static inline int server_address_pretty(ServerAddress *a, char **pretty) { + return sockaddr_pretty(&a->sockaddr.sa, a->socklen, true, pretty); +} + struct Manager { sd_event *event; sd_resolve *resolve; |