vmangos / core

Progressive Vanilla Core aimed at all versions from 1.2 to 1.12
GNU General Public License v2.0
669 stars 481 forks source link

handle negative time value in CharacterScreenIdleKick #2690

Closed shudza closed 3 months ago

shudza commented 3 months ago

🍰 Pullrequest

Fixes idle time calculation in CharacterScreenIdleKick.

The values can be negative since m_idleTime is set after the sessionUpdateTime, because the logout packet is proccessed after the sessionUpdateTime is set.

Proof

Proof that negative values are possible: idletime

Issues

If CharacterScreenMaxIdleTime is set, session will close upon logout and skip character screen.

How2Test

  1. set CharacterScreenMaxIdleTime to any value
  2. Login
  3. Logout
  4. Disconnected from server instead of character screen
ratkosrb commented 3 months ago

Can't we avoid temporary variables and casting to int64 by first checking that (currTime > m_idleTime) ?

shudza commented 3 months ago

fixed, thanks