From 3767771e8371ae837106e9885de2ce851165cf1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 18 Apr 2024 17:17:27 +0800 Subject: =?UTF-8?q?=E6=AF=8F=E4=B8=AA=E7=BA=BF=E7=A8=8B=E5=8F=AA=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=B8=80=E6=AC=A1update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/brave/work.lua | 2 +- script/proto/proto.lua | 7 ------- script/service/service.lua | 4 +++- 3 files changed, 4 insertions(+), 9 deletions(-) (limited to 'script') diff --git a/script/brave/work.lua b/script/brave/work.lua index 0514d1e2..cdba955e 100644 --- a/script/brave/work.lua +++ b/script/brave/work.lua @@ -54,7 +54,7 @@ brave.on('loadProtoBySocket', function (param) function lsmaster:on_data(data) lsclient:write(data) - net.update() + --net.update() end while true do diff --git a/script/proto/proto.lua b/script/proto/proto.lua index 01ff8238..78400f97 100644 --- a/script/proto/proto.lua +++ b/script/proto/proto.lua @@ -55,7 +55,6 @@ function m.send(data) io.write(buf) elseif m.mode == 'socket' then m.client:write(buf) - net.update() end end @@ -258,15 +257,9 @@ function m.listen(mode, socketPort) } m.client = dummyClient - local t = timer.loop(0.1, function () - net.update() - end) - function server:on_accepted(client) - t:remove() m.client = client client:write(dummyClient.buf) - net.update() end pub.task('loadProtoBySocket', { diff --git a/script/service/service.lua b/script/service/service.lua index 2c19b4f6..c3afd4cf 100644 --- a/script/service/service.lua +++ b/script/service/service.lua @@ -12,6 +12,7 @@ local ws = require 'workspace' local time = require 'bee.time' local fw = require 'filewatch' local furi = require 'file-uri' +local net = require 'service.net' require 'jsonc' require 'json-beautify' @@ -168,6 +169,7 @@ function m.eventLoop() end local function doSomething() + net.update() timer.update() pub.step(false) if await.step() then @@ -180,7 +182,7 @@ function m.eventLoop() local function sleep() idle() for _ = 1, 10 do - thread.sleep(100) + net.update(100) if doSomething() then return end -- cgit v1.2.3