Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data NtpSettings = NtpSettings {}
- data NtpStatus
- data CompletedNtpStatus
- ntpQuery ∷ IOManager → Tracer IO NtpTrace → NtpSettings → IO CompletedNtpStatus
- data NtpTrace
- = NtpTraceStartNtpClient
- | NtpTraceRestartDelay Int
- | NtpTraceRestartingClient
- | NtpTraceIOError IOError
- | NtpTraceLookupsFails
- | NtpTraceClientStartQuery
- | NtpTraceNoLocalAddr
- | NtpTraceResult NtpStatus
- | NtpTraceRunProtocolResults (ResultOrFailure [NtpOffset])
- | NtpTracePacketSent SockAddr NtpPacket
- | NtpTracePacketSendError SockAddr IOException
- | NtpTracePacketDecodeError SockAddr String
- | NtpTracePacketReceived SockAddr NtpPacket
- | NtpTraceWaitingForRepliesTimeout IPVersion
- data IPVersion
- data ResultOrFailure a
Documentation
data NtpSettings Source #
Settings of the ntp client.
NtpSettings | |
|
The Ntp client state: either cached results is availbale, or the ntp
client is engaged in ntp-protocol or there was a failure: e.g. connection
lost, or dns lookups did not return at least ntpRequiredNumberOfResults
addresses.
NtpDrift !NtpOffset | The difference between NTP time and local system time |
NtpSyncPending | NTP client has send requests to the servers |
NtpSyncUnavailable | NTP is not available: the client has not received any respond within
|
data CompletedNtpStatus Source #
A version of NtpStatus
specialized to the two "completed" states of that
type: NtpDrift
and NtpSyncUnavailable
.
CNtpDrift !NtpOffset | Corresponds to |
CNtpSyncUnavailable | Corresponds to |
ntpQuery ∷ IOManager → Tracer IO NtpTrace → NtpSettings → IO CompletedNtpStatus Source #
Perform a series of NTP queries: one for each dns name. Resolve each dns name, get local addresses: both IPv4 and IPv6 and engage in ntp protocol towards one ip address per address family per dns name, but only for address families for which we have a local address. This is to avoid trying to send IPv4/6 requests if IPv4/6 gateway is not configured.
We produce a CompletedNtpStatus
rather than an NtpStatus
because we would
never construct an NtpStatus
using NtpSyncPending
, so callers can avoid
catching and killing that case.
It may throw an IOException
:
- if neither IPv4 nor IPv6 address is configured
- if network I/O errors
Logging
A tag which describes which version of the ip protocol was used.
data ResultOrFailure a Source #
Result of two threads running concurrently.
BothSucceeded !a | both threads suceeded |
SuccessAndFailure !a !IPVersion !IOException | one of the threads errors. |
BothFailed !IOException !IOException | both threads failed |