Remove one-listener-at-once thing

It did not work properly anyway, as it only allowed one skynet.receive call to function... oops.
This commit is contained in:
Oliver Marks 2018-09-15 18:39:42 +01:00 committed by GitHub
parent 94d424680d
commit cd60f3741a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -50,13 +50,8 @@ function skynet.open(channel)
end
end
local listener_already_running = false
-- Converts "websocket_message"s into "skynet_message"s.
function skynet.listen(force)
-- If we already have a listener going, make this function just idle forever
-- Otherwise, we'd probably run into weirdness like multiple skynet_message events for each actual websocket message.
if listener_already_running and not force then while true do os.pullEvent() end end
listener_already_running = true
function skynet.listen()
skynet.connect()
while true do
local _, URL, contents = os.pullEvent "websocket_message"
@ -93,4 +88,4 @@ function skynet.send(channel, data)
}
end
return skynet
return skynet