mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
remove unused socket.lock/socket.unlock
This commit is contained in:
@@ -287,7 +287,6 @@ function socket.close(id)
|
|||||||
end
|
end
|
||||||
s.connected = false
|
s.connected = false
|
||||||
end
|
end
|
||||||
assert(s.lock == nil or next(s.lock) == nil)
|
|
||||||
socket_pool[id] = nil
|
socket_pool[id] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -403,34 +402,6 @@ function socket.listen(host, port, backlog)
|
|||||||
return driver.listen(host, port, backlog)
|
return driver.listen(host, port, backlog)
|
||||||
end
|
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
|
-- abandon use to forward socket id to other service
|
||||||
-- you must call socket.start(id) later in other service
|
-- you must call socket.start(id) later in other service
|
||||||
function socket.abandon(id)
|
function socket.abandon(id)
|
||||||
|
|||||||
Reference in New Issue
Block a user