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 | 26 | |
27 | 27 | _codeSession = {} |
28 | 28 | |
29 | +local logDoCount = 0 | |
30 | +local logDoStart = nil | |
31 | + | |
29 | 32 | --- {{{ 定时器相关 |
30 | 33 | local function handle_timeout() |
31 | 34 | if not agentInfo.open_timer then return end |
... | ... | @@ -216,7 +219,7 @@ skynet.register_protocol { |
216 | 219 | if agentInfo.role then |
217 | 220 | agentInfo.role:startActionUcode() |
218 | 221 | end |
219 | - | |
222 | + logDoCount = logDoCount + 1 | |
220 | 223 | local result = method(agentInfo, data) |
221 | 224 | |
222 | 225 | if agentInfo.role then |
... | ... | @@ -251,6 +254,7 @@ skynet.register_protocol { |
251 | 254 | end, |
252 | 255 | } |
253 | 256 | |
257 | + | |
254 | 258 | -- function CMD.start(gate, fd, ip) |
255 | 259 | function CMD.start(session, source, gate, fd, ip, hotfixs) |
256 | 260 | ignoreHeartbeat = false |
... | ... | @@ -269,7 +273,7 @@ function CMD.start(session, source, gate, fd, ip, hotfixs) |
269 | 273 | end |
270 | 274 | |
271 | 275 | start_agent_timer() |
272 | - | |
276 | + logDoStart = skynet.timex() | |
273 | 277 | -- 这里将消息伪装成 watchdog 发出,这样就由 A->B->C->B->A 变成 A->B->C->A |
274 | 278 | skynet.redirect(gate, source, "lua", session, skynet.pack("forward", fd, 0, skynet.self())) |
275 | 279 | end |
... | ... | @@ -282,6 +286,10 @@ function CMD.close() |
282 | 286 | if not role then return end |
283 | 287 | role:log("onLogout", {logtime = skynet.timex()-role:getProperty("ltime")}) |
284 | 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 | 293 | role:onOfflineEvent() |
286 | 294 | end |
287 | 295 | ... | ... |