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:
parent
94d424680d
commit
cd60f3741a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue