Update libevent

Fix GetNextEvent. Now GetNextEvent will wait infinitely by default.
Update transport system due to libnetbox api update.
This commit is contained in:
Kirigaya Kazuto 2018-01-08 11:20:04 +08:00
parent 5c5ee4da37
commit 757d965bf2
3 changed files with 9 additions and 7 deletions

View File

@ -290,13 +290,17 @@ function GetNextEvent(t,wait_second)
checktable(t) checktable(t)
if(wait_second~=nil) then if(wait_second~=nil) then
checknumber(wait_second) checknumber(wait_second)
else
-- This has caused thousands of error! Now, without wait_second, by default, it means wait infinitely.
-- If you want a non-blocking check, call GetNextEvent(bus,0) instead!
wait_second=-1
end end
if(t.events[1]~=nil) then if(t.events[1]~=nil) then
local e=t.events[1] local e=t.events[1]
table.remove(t.events,1) table.remove(t.events,1)
return e return e
elseif(wait_second~=nil) then else
if(wait_second<0) then if(wait_second<0) then
while t.events[1]==nil do while t.events[1]==nil do
os.sleep(1) os.sleep(1)
@ -316,8 +320,6 @@ function GetNextEvent(t,wait_second)
else else
return nil return nil
end end
else
return nil
end end
end end

View File

@ -33,7 +33,7 @@ end
local function main() local function main()
checkDevice() checkDevice()
clientServiceStart() NetBoxInit()
OpenPort(10010) OpenPort(10010)
@ -57,7 +57,7 @@ local function main()
end end
ClosePort(10010) ClosePort(10010)
clientServiceStop() NetBoxCleanUp()
end end
print("Transport System Center Started.") print("Transport System Center Started.")

View File

@ -342,7 +342,7 @@ local function main()
checkDevice() checkDevice()
resetDevice() resetDevice()
clientServiceStart() NetBoxInit()
while true do while true do
print( print(
@ -367,7 +367,7 @@ local function main()
resetDevice() resetDevice()
unlockUnloadChest() unlockUnloadChest()
clientServiceStop() NetBoxCleanUp()
end end
print("Transport System Client Started.") print("Transport System Client Started.")