Commit 803170fd52227025dd813fb96b99444a92333763
1 parent
7cba6588
玩家操作记录
Showing
1 changed file
with
10 additions
and
2 deletions
Show diff stats
src/agent.lua
@@ -26,6 +26,9 @@ _hotfixClass = _hotfixClass or {} | @@ -26,6 +26,9 @@ _hotfixClass = _hotfixClass or {} | ||
26 | 26 | ||
27 | _codeSession = {} | 27 | _codeSession = {} |
28 | 28 | ||
29 | +local logDoCount = 0 | ||
30 | +local logDoStart = nil | ||
31 | + | ||
29 | --- {{{ 定时器相关 | 32 | --- {{{ 定时器相关 |
30 | local function handle_timeout() | 33 | local function handle_timeout() |
31 | if not agentInfo.open_timer then return end | 34 | if not agentInfo.open_timer then return end |
@@ -216,7 +219,7 @@ skynet.register_protocol { | @@ -216,7 +219,7 @@ skynet.register_protocol { | ||
216 | if agentInfo.role then | 219 | if agentInfo.role then |
217 | agentInfo.role:startActionUcode() | 220 | agentInfo.role:startActionUcode() |
218 | end | 221 | end |
219 | - | 222 | + logDoCount = logDoCount + 1 |
220 | local result = method(agentInfo, data) | 223 | local result = method(agentInfo, data) |
221 | 224 | ||
222 | if agentInfo.role then | 225 | if agentInfo.role then |
@@ -251,6 +254,7 @@ skynet.register_protocol { | @@ -251,6 +254,7 @@ skynet.register_protocol { | ||
251 | end, | 254 | end, |
252 | } | 255 | } |
253 | 256 | ||
257 | + | ||
254 | -- function CMD.start(gate, fd, ip) | 258 | -- function CMD.start(gate, fd, ip) |
255 | function CMD.start(session, source, gate, fd, ip, hotfixs) | 259 | function CMD.start(session, source, gate, fd, ip, hotfixs) |
256 | ignoreHeartbeat = false | 260 | ignoreHeartbeat = false |
@@ -269,7 +273,7 @@ function CMD.start(session, source, gate, fd, ip, hotfixs) | @@ -269,7 +273,7 @@ function CMD.start(session, source, gate, fd, ip, hotfixs) | ||
269 | end | 273 | end |
270 | 274 | ||
271 | start_agent_timer() | 275 | start_agent_timer() |
272 | - | 276 | + logDoStart = skynet.timex() |
273 | -- 这里将消息伪装成 watchdog 发出,这样就由 A->B->C->B->A 变成 A->B->C->A | 277 | -- 这里将消息伪装成 watchdog 发出,这样就由 A->B->C->B->A 变成 A->B->C->A |
274 | skynet.redirect(gate, source, "lua", session, skynet.pack("forward", fd, 0, skynet.self())) | 278 | skynet.redirect(gate, source, "lua", session, skynet.pack("forward", fd, 0, skynet.self())) |
275 | end | 279 | end |
@@ -282,6 +286,10 @@ function CMD.close() | @@ -282,6 +286,10 @@ function CMD.close() | ||
282 | if not role then return end | 286 | if not role then return end |
283 | role:log("onLogout", {logtime = skynet.timex()-role:getProperty("ltime")}) | 287 | role:log("onLogout", {logtime = skynet.timex()-role:getProperty("ltime")}) |
284 | role:mylog("logout", {int1 = skynet.timex()-role:getProperty("ltime")}) | 288 | role:mylog("logout", {int1 = skynet.timex()-role:getProperty("ltime")}) |
289 | + if logDoCount == 0 then | ||
290 | + logDoCount = 1 | ||
291 | + end | ||
292 | + skynet.error("LOG_PLAYER_DO " .. math.ceil((skynet.timex() - logDoStart) / logDoCount)) | ||
285 | role:onOfflineEvent() | 293 | role:onOfflineEvent() |
286 | end | 294 | end |
287 | 295 |