From 0f5867534cc3be966f71fbdd327abf2498e441aa Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Wed, 7 Apr 2021 02:54:09 +0000 Subject: [PATCH] remove unused socket.lock/socket.unlock --- lualib/skynet/socket.lua | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/lualib/skynet/socket.lua b/lualib/skynet/socket.lua index 8371853a..e99d3ca5 100644 --- a/lualib/skynet/socket.lua +++ b/lualib/skynet/socket.lua @@ -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)