remove unused socket.lock/socket.unlock

This commit is contained in:
Cloud Wu
2021-04-07 02:54:09 +00:00
parent ceb278adf6
commit 0f5867534c

View File

@@ -287,7 +287,6 @@ function socket.close(id)
end
s.connected = false
end
assert(s.lock == nil or next(s.lock) == nil)
socket_pool[id] = nil
end
@@ -403,34 +402,6 @@ function socket.listen(host, port, backlog)
return driver.listen(host, port, backlog)
end
function socket.lock(id)
local s = socket_pool[id]
assert(s)
local lock_set = s.lock
if not lock_set then
lock_set = {}
s.lock = lock_set
end
if #lock_set == 0 then
lock_set[1] = true
else
local co = coroutine.running()
table.insert(lock_set, co)
skynet.wait(co)
end
end
function socket.unlock(id)
local s = socket_pool[id]
assert(s)
local lock_set = assert(s.lock)
table.remove(lock_set,1)
local co = lock_set[1]
if co then
skynet.wakeup(co)
end
end
-- abandon use to forward socket id to other service
-- you must call socket.start(id) later in other service
function socket.abandon(id)