propose fix for #3628

This commit is contained in:
Adrian Siekierka 2023-06-28 15:26:45 +02:00
parent 1b7761f4ce
commit f275e0d44a
5 changed files with 12 additions and 8 deletions

View File

@ -1,7 +1,11 @@
## Fixes/improvements
* [#3635] ArrayIndexOutOfBoundsException when using servers with 3 network cards
* [#3634] Internet card selector update logic erroneously drops non-ready keys
* [#3635] Fix ArrayIndexOutOfBoundsException when using servers with 3 network cards
* [#3634] Fix Internet card selector update logic erroneously dropping non-ready keys
## OpenOS fixes/improvements
* [#3628] Fix jitter when using os.sleep()
## List of contributors

View File

@ -51,7 +51,7 @@ local function doSleep()
local deadline = computer.uptime() + (tonumber(options.i) or tonumber(options.interval) or 1)
repeat
event.pull(deadline - computer.uptime())
until computer.uptime() >= deadline
until (computer.uptime() - deadline) >= -0.001
end
local function doPing()
@ -66,9 +66,9 @@ local function doPing()
local e, replier, id, inpayload
repeat
e, replier, id, inpayload = event.pull(deadline - computer.uptime(), "ping_reply")
until computer.uptime() >= deadline or (e == "ping_reply" and id == icmp_seq)
until ((computer.uptime() - deadline) >= -0.001) or (e == "ping_reply" and id == icmp_seq)
if computer.uptime() >= deadline and e ~= "ping_reply" then
if ((computer.uptime() - deadline) >= -0.001) and e ~= "ping_reply" then
verbose(tostring(len).." bytes lost: icmp_seq="..tostring(icmp_seq))
elseif inpayload == payload then
stats.received = stats.received + 1

View File

@ -27,7 +27,7 @@ function os.sleep(timeout)
local deadline = computer.uptime() + (timeout or 0)
repeat
event.pull(deadline - computer.uptime())
until computer.uptime() >= deadline
until (computer.uptime() - deadline) >= -0.001
end
os.setenv("PATH", "/bin:/usr/bin:/home/bin:.")

View File

@ -1,7 +1,7 @@
-- called from /init.lua
local raw_loadfile = ...
_G._OSVERSION = "OpenOS 1.8.2"
_G._OSVERSION = "OpenOS 1.8.3"
-- luacheck: globals component computer unicode _OSVERSION
local component = component

View File

@ -1405,7 +1405,7 @@ local libcomputer = {
if signal.n > 0 then
return table.unpack(signal, 1, signal.n)
end
until computer.uptime() >= deadline
until (computer.uptime() - deadline) >= -0.001
end,
beep = function(...)