瀏覽代碼

修改服务管理池

neo 1 年之前
父節點
當前提交
9a9b30869b

+ 4 - 4
nodes/battle/service/srvBattleMgr.lua

@@ -16,22 +16,22 @@ local pool
16
 local CMD = {}
16
 local CMD = {}
17
 
17
 
18
 function CMD.getBattleAgent()
18
 function CMD.getBattleAgent()
19
-    return pool:allocation()
19
+    return pool:alloc_agent_srv()
20
 end
20
 end
21
 
21
 
22
 -- from agent
22
 -- from agent
23
 function CMD.battleEnter(id, battleAgent)
23
 function CMD.battleEnter(id, battleAgent)
24
-    pool:bindAgent(id, battleAgent)
24
+    pool:bind_agent(id, battleAgent)
25
 end
25
 end
26
 
26
 
27
 -- from agent
27
 -- from agent
28
 function CMD.battleLeave(id, battleAgent)
28
 function CMD.battleLeave(id, battleAgent)
29
-    pool:unbindAgent(id, battleAgent)
29
+    pool:unbind_agent(id, battleAgent)
30
 end
30
 end
31
 
31
 
32
 -- 玩家是否在战斗中
32
 -- 玩家是否在战斗中
33
 function CMD.is_user_in_battle(uid, battleId, battleAgent)
33
 function CMD.is_user_in_battle(uid, battleId, battleAgent)
34
-    if battleAgent == nil or not pool:getObj(battleAgent) then
34
+    if battleAgent == nil or not pool:get_agent_info_by_addr(battleAgent) then
35
         return false
35
         return false
36
     end
36
     end
37
     local ok = skynet.call(battleAgent, "lua", "is_user_in_battle", uid, battleId)
37
     local ok = skynet.call(battleAgent, "lua", "is_user_in_battle", uid, battleId)

+ 4 - 4
nodes/game/service/srvAgentMgr.lua

@@ -23,12 +23,12 @@ function root.user_get_game_agent(uid)
23
 	if mapUid2Agent[uid] then
23
 	if mapUid2Agent[uid] then
24
 		log.error("uid:%s上一次的agent地址没有释放", uid)
24
 		log.error("uid:%s上一次的agent地址没有释放", uid)
25
 	end
25
 	end
26
-	return pool:allocation(uid)
26
+	return pool:alloc_agent_srv(uid)
27
 end
27
 end
28
 
28
 
29
 -- 玩家登陆游戏服
29
 -- 玩家登陆游戏服
30
 function root.login(uid, session)
30
 function root.login(uid, session)
31
-	pool:bindAgent(uid, session.gameAgent)
31
+	pool:bind_agent(uid, session.gameAgent)
32
 
32
 
33
 	mapUid2Agent[uid] = session.gameAgent
33
 	mapUid2Agent[uid] = session.gameAgent
34
 	-- log.error("uid:%s登陆成功绑定agent地址:%s", uid, gSession.gameAgent)
34
 	-- log.error("uid:%s登陆成功绑定agent地址:%s", uid, gSession.gameAgent)
@@ -36,7 +36,7 @@ end
36
 
36
 
37
 -- 玩家退出游戏服
37
 -- 玩家退出游戏服
38
 function root.logout(uid, session)
38
 function root.logout(uid, session)
39
-	pool:unbindAgent(uid, session.gameAgent)
39
+	pool:unbind_agent(uid, session.gameAgent)
40
 	mapUid2Agent[uid] = nil
40
 	mapUid2Agent[uid] = nil
41
 	-- log.error("uid:%s下线成功, 解绑agent地址:%s", uid, gSession.gameAgent)
41
 	-- log.error("uid:%s下线成功, 解绑agent地址:%s", uid, gSession.gameAgent)
42
 end
42
 end
@@ -58,7 +58,7 @@ function root.onStop()
58
 end
58
 end
59
 
59
 
60
 function root.exit(agent)
60
 function root.exit(agent)
61
-	pool:remove(agent)
61
+	pool:remove_agent_service(agent)
62
 	-- agent全部退出 唤醒退出协程
62
 	-- agent全部退出 唤醒退出协程
63
 	local addrList = pool:get_agent_srv_addr_list()
63
 	local addrList = pool:get_agent_srv_addr_list()
64
 	if #addrList <= 0 then
64
 	if #addrList <= 0 then

+ 3 - 3
nodes/gate/service/wsProtobufWatchdog.lua

@@ -40,7 +40,7 @@ local function l_close_connect(fd)
40
 		local gateAgent = session.gateAgent
40
 		local gateAgent = session.gateAgent
41
 		skynet.call(gateAgent, "lua", "logout", uid, fd)
41
 		skynet.call(gateAgent, "lua", "logout", uid, fd)
42
 
42
 
43
-		pool:unbindAgent(uid, gateAgent)
43
+		pool:unbind_agent(uid, gateAgent)
44
 	end
44
 	end
45
 end
45
 end
46
 
46
 
@@ -106,7 +106,7 @@ local function l_build_connection(uid, fd, msgSession)
106
 	mapUid2Session[uid] = session
106
 	mapUid2Session[uid] = session
107
 
107
 
108
 	-- 分配agent
108
 	-- 分配agent
109
-	local gateAgent = pool:allocation(uid)
109
+	local gateAgent = pool:alloc_agent_srv(uid)
110
 	if gateAgent == nil then
110
 	if gateAgent == nil then
111
 		session.status = LOGIN_DONE
111
 		session.status = LOGIN_DONE
112
 		l_response_auth(fd, code.UNKNOWN, msgSession)
112
 		l_response_auth(fd, code.UNKNOWN, msgSession)
@@ -127,7 +127,7 @@ local function l_build_connection(uid, fd, msgSession)
127
 	end
127
 	end
128
 
128
 
129
 	-- 绑定agent
129
 	-- 绑定agent
130
-	pool:bindAgent(uid, gateAgent)
130
+	pool:bind_agent(uid, gateAgent)
131
 	return l_response_auth(fd, code.OK, msgSession)
131
 	return l_response_auth(fd, code.OK, msgSession)
132
 end
132
 end
133
 
133
 

+ 3 - 3
nodes/gate/service/wsSprotoWatchdog.lua

@@ -40,7 +40,7 @@ local function l_close_connect(fd)
40
 		local gateAgent = session.gateAgent
40
 		local gateAgent = session.gateAgent
41
 		skynet.call(gateAgent, "lua", "logout", uid, fd)
41
 		skynet.call(gateAgent, "lua", "logout", uid, fd)
42
 
42
 
43
-		pool:unbindAgent(uid, gateAgent)
43
+		pool:unbind_agent(uid, gateAgent)
44
 	end
44
 	end
45
 end
45
 end
46
 
46
 
@@ -106,7 +106,7 @@ local function l_build_connection(uid, fd, response)
106
 	mapUid2Session[uid] = session
106
 	mapUid2Session[uid] = session
107
 
107
 
108
 	-- 分配agent
108
 	-- 分配agent
109
-	local gateAgent = pool:allocation(uid)
109
+	local gateAgent = pool:alloc_agent_srv(uid)
110
 	if gateAgent == nil then
110
 	if gateAgent == nil then
111
 		session.status = LOGIN_DONE
111
 		session.status = LOGIN_DONE
112
 		l_response_auth(fd, response, code.UNKNOWN)
112
 		l_response_auth(fd, response, code.UNKNOWN)
@@ -127,7 +127,7 @@ local function l_build_connection(uid, fd, response)
127
 	end
127
 	end
128
 
128
 
129
 	-- 绑定agent
129
 	-- 绑定agent
130
-	pool:bindAgent(uid, gateAgent)
130
+	pool:bind_agent(uid, gateAgent)
131
 	return l_response_auth(fd, response, code.OK)
131
 	return l_response_auth(fd, response, code.OK)
132
 end
132
 end
133
 
133