From a0d47a5f1a3e963778636531f5b5183cea398168 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Sat, 24 Nov 2018 21:45:10 -0500 Subject: [PATCH] allow up to 10 sec diff in connect time due to clock mismatch in dims --- sys/apis/point.lua | 7 +++++++ sys/apis/socket.lua | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/apis/point.lua b/sys/apis/point.lua index 9eca46d..1d83eab 100644 --- a/sys/apis/point.lua +++ b/sys/apis/point.lua @@ -48,6 +48,13 @@ function Point.copy(pt) return { x = pt.x, y = pt.y, z = pt.z } end +function Point.round(pt) + pt.x = Util.round(pt.x) + pt.y = Util.round(pt.y) + pt.z = Util.round(pt.z) + return pt +end + function Point.same(pta, ptb) return pta.x == ptb.x and pta.y == ptb.y and diff --git a/sys/apis/socket.lua b/sys/apis/socket.lua index 7db64ae..9b91750 100644 --- a/sys/apis/socket.lua +++ b/sys/apis/socket.lua @@ -172,7 +172,7 @@ local function trusted(msg, port) local data = Crypto.decrypt(msg.t or '', pubKey) --local sharedKey = modexp(pubKey, exchange.secretKey, public.primeMod) - return data.ts and tonumber(data.ts) and math.abs(os.time() - data.ts) < 1 + return data.ts and tonumber(data.ts) and math.abs(os.time() - data.ts) < 10 end end