Commit 5d00e036 authored by Bas Westerbaan's avatar Bas Westerbaan

Do not hand out timestamps too far in the future

parent badeea91
......@@ -158,7 +158,11 @@ func serverInfoHandler(w http.ResponseWriter, r *http.Request) {
func processAtumRequest(req atum.Request) (resp atum.Response) {
var tsTime int64
if req.Time != nil {
if time.Now().Unix()-*req.Time > conf.AcceptableLag {
lag := time.Now().Unix() - *req.Time
if lag < 0 {
lag = -lag
}
if lag > conf.AcceptableLag {
resp.SetError(atum.ErrorCodeLag)
resp.Info = getServerInfo()
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment