Commit Graph

830 Commits

Author SHA1 Message Date
Mikhail Redko
558382ed6d Core/WorldSession: Add RBAC permission for skipping idle connection check (#20595) 2017-10-13 22:26:53 +02:00
Treeston
7dfd472f8d Proper client timeout detection (#19906)
- Properly detect client timeout when logged into a character after a configurable time (default 60s) has passed without the client sending any packets.
- Fixes issues with crashed clients leaving characters in the world for a very long time (default 15 minutes), as well as edge case exploits involving intentionally pausing client execution for some amount of time.
2017-06-27 00:22:33 +02:00
ariel-
85a7d5ce9a Core: ported headers cleanup from master branch 2017-06-19 23:20:06 -03:00
Shauren
7874bee7bf Core/Misc: Cleanup worldserver/authserver main() functions to run destructors in predictable order
* world/auth servers will now fail to startup if listen ports are in use
* Restored "Network.OutUBuff" config option lost during boost transition

(cherry picked from commit 6c92a481a3)
2017-06-19 04:04:21 -03:00
xinef1
a4aa95a5a3 Core/Misc: implemented petition manager (#19010)
- Implemented manager for petitions to perform all petition related tasks and synchronize data with database.
- This kills ugly synchronous querys on packet handlers
2017-04-27 02:02:33 -03:00
jackpoz
6940071994 Core/Misc: Fix static analysis issues 2017-02-25 15:54:11 +01:00
ariel-
dd1aa64563 Core/Packet: convert query packets into new system.
- Extra c++11-ification of existing code
- Refs #18637
2017-02-21 03:03:58 -03:00
jackpoz
76f3e0edea Core/WorldSocket: Handle unhandled exceptions
Properly handle unhandled exceptions happening with malformed packets.
Fix #19128
2017-02-18 11:36:02 +01:00
ariel-
60dd803bbe Core/Server: fix duplicated inserts into tutorials table for newly created characters 2017-01-29 14:00:19 -03:00
xinef1
88f746935f Remade who list processing (#18636)
* Remade who list processing, requests are now processed in maps. Player entries are now copied every 5 seconds to dedicated storage (avoids usage of hashmapholder mutex)
2017-01-29 00:59:17 -03:00
xinef1
b955456008 Few small optimizations here and there (#18684)
Changes list:
- Added CharacterGuidByNameContainer which contains name -> guid unordered map (updated along CharacterInfo)
- Extended CharacterInfo structure with GuildId
- Extended CharacterInfo structure with ArenaTeamId[3], for all possible teams (2v2, 3v3, 5v5)
- Removed CHAR_SEL_GUID_BY_NAME and CHAR_SEL_CHAR_GUID_BY_NAME synchronous queries, name -> guid can be now retrieved in World::GetCharacterGuidByName
- Removed CHAR_SEL_GUID_RACE_ACC_BY_NAME synchronous query, guid can be retrieved by name and rest of the data can be retrieved by guid
- Removed CHAR_SEL_CHAR_LEVEL synchronous query, level can be retrieved by guid
- Changed CHAR_SEL_CHARACTER_ACTIONS_SPEC to asynchronous query, action bars are now loaded asynchronously
- Removed CHAR_SEL_CHARACTER_NAME_CLASS synchronous query, guid can be retrieved by name and rest of the data can be retrieved by guid
- Removed CHAR_SEL_PLAYER_ARENA_TEAMS and CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID synchronous queries, arena teams are now stored in CharacterInfo
- Replaced synchronous db calls with CharacterInfo lookups
- Removed ObjectMgr::GetPlayerGUIDByName, as it used db query
- Replaced some unnecessary UpdateObjectVisibility() calls because they were either duplicated (called few lines above in other function) or it is enough to call DestroyForNearbyPlayers because object is being removed or should be invisible and DestroyForNearbyPlayers is faster
- Corrected typo in Player::DestroyForPlayer, only items in slots 0 to EQUIPMENT_SLOT_END are sent to other players
- Renamed Player::GetGuildIdFromDB to Player::GetGuildIdFromCharacterInfo and changed the function to use CharacterInfo structure
- Renamed Player::GetArenaTeamIdFromDB to Player::GetArenaTeamIdFromCharacterInfo and changed the function to use CharacterInfo structure
- Renamed Player::GetLevelFromDB to Player::GetLevelFromCharacterInfo and changed the function to use CharacterInfo structure
- Removed GameEventMgr::_questToEventLinks and associated functions, eventId is now stored in Quest class under _eventIdForQuest variable
- Changed some functions checking quest status to use other functions for quest status check instead of duplicating code
- Removed callback from add friend, because we can get the guid from appropriate storage, no need to make db query
- Removed callback from add ignore, because we can get the guid from appropriate storage, no need to make db query
- Added callback to unwrap wrapped items asynchronously
- Removed synchronous select in tutorials to check if we have any entries in db, if any entry exists in db, m_TutorialsChanged variable will have TUTORIALS_FLAG_LOADED_FROM_DB flag added and it is no longer necessary to query database
2017-01-28 01:00:28 -03:00
Shauren
4c27203c8f Core/DBLayer: Convert async queries to new query callbacks and remove old callback handling
(cherry picked from commit 8e2634b2b4)

Conflicts:
	src/server/bnetserver/Server/Session.cpp
	src/server/bnetserver/Server/Session.h
	src/server/database/Database/QueryCallback.cpp
	src/server/game/Handlers/CharacterHandler.cpp
	src/server/game/Handlers/SocialHandler.cpp
	src/server/game/Server/WorldSession.cpp
	src/server/game/Server/WorldSession.h
	src/server/game/Server/WorldSocket.cpp
	src/server/game/Server/WorldSocket.h
	src/server/game/World/World.cpp
	src/server/game/World/World.h
2017-01-25 23:38:13 -03:00
joschiwald
62b62ddd63 Core/Packets: updated some contactlist packets
(cherry picked from commit e01bb91887)

Conflicts:
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Player/Player.h
	src/server/game/Entities/Player/SocialMgr.cpp
	src/server/game/Entities/Player/SocialMgr.h
	src/server/game/Handlers/MiscHandler.cpp
	src/server/game/Server/Packets/MiscPackets.cpp
	src/server/game/Server/Protocol/Opcodes.cpp
	src/server/game/Server/Protocol/Opcodes.h
	src/server/game/Server/WorldSession.cpp
	src/server/game/Server/WorldSession.h
	src/server/shared/Database/Implementation/CharacterDatabase.cpp
	src/server/shared/Database/Implementation/CharacterDatabase.h
2017-01-25 23:36:24 -03:00
tkrokli
6a51a88767 Update Copyright notice for 2017
Happy new year!
2017-01-02 19:52:45 +01:00
Treeston
8deda7ed7f Entities/Unit: Cleanup refactor. Changes: (#17819)
+ Unit::m_movedPlayer -> Unit::m_playerMovingMe
+ Player::m_mover -> Player::m_unitMovedByMe
+ Unit::GetMover() -> Unit::GetUnitBeingMoved()
+ Unit::GetPlayerMover() -> Unit::GetPlayerBeingMoved()
+ NEW: Unit::GetClientControllingPlayer()
2016-08-20 12:43:04 +02:00
jackpoz
4073cc510a Core/Packets: Port packet handling rework from 6.x branch (#17777)
* Core/Packets: Port packet handling rework from 6.x branch

Port packet handling reword from 6.x branch. Old handlers are still used at the moment, these changes allow to port old handlers to new packet-specifc ones.
2016-08-19 22:29:00 +02:00
ariel-
ef85d01746 Core/Entities: Readded check removed in d7460887c8, caused flying ghost players to not move if they died during a root effect, root flag was never cleared clientside and impeded movement. 2016-07-19 02:31:28 -03:00
Shauren
ce947814c6 Core/PacketIO: Fixed crash happening when someone sends too small packet that is processed directly in WorldSocket
Ref #17536
2016-07-07 18:22:29 +02:00
elecyb
d7460887c8 Core/Entities: Moved PITCH movement flags into TURNING mask (they do not cause movement in any direction alone, only combined with forward/backward/strafe)
Closes #16256
2016-06-18 16:53:34 +02:00
elecyb
f8e87a445a Core/Player: Fix ghost players water walking visual bug
Fix bug of ghost players appearing as swimming to other players instead of water walking.
Ref #16256
2016-06-18 14:55:48 +02:00
Duarte Duarte
3ae1016082 Implement real time statistic visualization (#16956)
Docs at https://trinitycore.atlassian.net/wiki/display/tc/Monitoring+a+TrinityCore+server

* Common/Graphs: Initial proof of concept

* Move influx db code to its own class

* Reuse the same socket

* Allow to log values of different categories

* Allow to log events

* Pass the timestamp to influxdb

* Send events in batches

* Send data async

* Log server shutdown.
Fix memory leak.

* Allow to enable/disable Stats in the settings and at runtime

* Read interval between each batch send from config

* Add InfluxDB connection info to configs

* Move each event category to its own table

* Log pathfinding queries

* Move categories table initialization to constructor using enum as key to avoid assigning the table name to the wrong enum value

* Log player login/logout events.
Pass the hostname correctly in the HTTP request.

* Fix linux build

* Handle "Connection: close" HTTP header, reconnecting on next scheduled send.
Disable StatsLogger if connection fails, logging the error.

* Add an enum for categories of logged values, it's still possible to pass a string instead of the enum.

* Don't log the whole batchedData when InfluxDB returns an error, it's too long and unreadable on console.

* Allow to call a function at a specified interval in thread-safe World::Update() context to log data like player count.

* Log map tile load/unload

* Core/StatsLogger: Allow logging more value types other than ints

https://docs.influxdata.com/influxdb/v0.10/write_protocols/write_syntax/

* Fix a typo in string escape of StatsLogger

* Yet more fixes to the escaping in FormatInfluxDBValue

* DB/Gameobject: Fix respawn time of few Quest GameObjects

By Tauriella, closes #16701

* DB/Misc: Fix some engrish

By tkrokli closes #16648

* Tools/MMaps: Add format library linking to mmaps_generator

(Very) partial cherry pick of ed75b0649a

* Core/StatsLogger: Simplify code

Convert values and categories arrays to maps initialized in-place
Remove constructor and destructor

* Core/StatsLogger: Add realm name to the event and value tags

* Log amount of processed packet of each session

* Apply recent singleton changes to sStatsLogger too

* Fix influxdb data format if no realm name is present

* Remove unneeded newlines from request body, fixes response 400 from InfluxDB 0.10

* Rename Reporting folder to Metric

* Rename StatsLogger to Metric

* Rename InfluxDB configs to Metric

* Add Grafana dashboards

* Add a random annoying macro

* Move string formatting to Metric::SendBatch(), reducing performance footprint of Metric::LogEvent() and Metric::LogValue()

* Update grafana graphs refresing tags on load and showing now-15m data, refreshing every minute. These settings can be modified in grafana.

* Rename MetricData fields

* Contrib/Grafana: Rename dashboard files

* Contrib/Grafana: Replace hardcoded Windows/Ubuntu realm names by the default, Trinity

* Config/Worldserver: Add missing section to the index

* Contrib/Grafana: Add singlestat panels with current online players, update diff averages (1 min, 5 mins and 15 mins)

http://i.imgur.com/Zi8lfvS.png

* Core/Metric: Replace the enums MetricEventCategory and MetricValueCategory by strings

For the sake of simplicity and less recompile time when adding new metrics, similar to how TC_LOG_* works

* Contrib/Grafana: Display the current number of online players and not its average

Closes #15075
2016-06-04 11:23:29 +01:00
Shauren
bee6525d1b Core/Misc: Fixed -Wmisleading-indentation warnings
(cherry picked from commit 3ac33163db)

# Conflicts:
#	src/server/game/Server/Protocol/PacketLog.cpp
2016-04-28 16:22:51 +01:00
Patrick L
514b908170 Core/PacketIO: Missing changes from 548aa119ac that could result in a crash due to double Locking (#17008)
Socket will be closed because of ReadDataHandlerResult::Error.
2016-04-20 17:03:40 +02:00
DDuarte
980f28d2ce Core/Network: Change SocketMgr.StartNetwork to take the thread count by arg instead of config
AuthSocketMgr doesn't need "Network.Threads" config

Fixes "Missing name Network.Threads in config file authserver.conf"

Ref #16859
2016-03-28 02:02:29 +01:00
Naios
9f61b72679 Core/Game: Converted the game library to a shared library.
* There is still the possibility to static link against game.

(cherry picked from commit bf33159a70)
2016-03-24 02:46:42 +01:00
Vincent-Michael
5e74c2223b Core: Remove whitespaces 2016-03-16 21:40:15 +01:00
Duarte Duarte
632e66784b Core/PacketIO: Revert STATUS_UNHANDLED logging back to debug
Ref 5a6db6e84d
Closes #16773
2016-03-15 01:12:21 +00:00
Shauren
5a6db6e84d Core/Misc: Minimize differences between branches in WorldSession::Update
This commit removes OnUnknownPacketReceive script hook - it could never be fired anyway at that point
2016-03-13 00:12:09 +01:00
Shauren
9fc5c4bc41 Core/PacketIO: Requeue packets handled with STATUS_LOGGEDIN received before player is fully loaded in one step after packet processing loop - reduces used locks from 3 per packet to 1 per packet
(cherry picked from commit 8086a39210)
2016-03-12 23:49:39 +01:00
Shauren
3ed41235f3 Core/Misc: Removed unneccessary boost/asio/buffer.hpp include
(cherry picked from commit 01be486f2f)
2016-03-12 23:44:49 +01:00
Shauren
39dd376c40 Core/Logging: Include more info in bad realm log
(cherry picked from commit a6dd6d7841)
2016-03-12 23:43:08 +01:00
Carbenium
f29e380797 Core/Player:
* sprinkle some consts
* replace some C-style casts by static_cast
* replace NULL by nullptr

(cherry picked from commit b705ebeb7f)

# Conflicts:
#	src/server/game/Entities/Player/Player.cpp
#	src/server/game/Entities/Player/Player.h
2016-03-12 22:36:45 +01:00
Naios
b7f936891a Core/Game: Move singleton instances into compilation units
* Fixes issues when building shared libraries
  (prevents gcc and clang from providing several instance)

(cherry picked from commit 329225b40d)
2016-03-11 20:03:12 +01:00
DDuarte
2ea31027e5 Core: Backport 6.x realm changes
Make acessible all the info about current realm (e.g name) anywhere, not only realm id
Reduce the number of differences between the two branches

Original changes by Shauren

Partial port of bacc90b6ba and 63def8aa32
2016-03-06 19:46:59 +00:00
Shauren
b2e03a7448 Core/Networking: Rewrite networking threading model
Each network thread has its own io_service - this means that all operations on a given socket except queueing packets run from a single thread, removing the need for locking
Sending packets now writes to a lockfree intermediate queue directly, encryption is applied in network thread if it was required at the time of sending the packet

(cherry picked from commit 97a79af470)
2016-02-20 13:08:03 +01:00
Rushor
923a368ac7 Update copyright note for 2016 2016-01-01 12:02:33 +01:00
jackpoz
1ddf44caf3 Core/Quest: Fix issues reported by static analysis 2015-12-07 18:31:53 +01:00
MitchesD
3b90b0368a Core/Misc: fix warning and misc codestyle fixes 2015-11-26 19:28:53 +01:00
Shauren
60da7c6552 Core/Networking: Fixed possible crashes happening if async query retrieving account data takes too long
Closes #14944

(cherry picked from commit 590c6e399d)
2015-10-31 16:04:14 +01:00
Shauren
97fe228334 Core/Threading: Fixed possible data races after making auth queries async by moving their processing to boost::asio::io_service::run threads
(cherry picked from commit f6bc87fe5d)
2015-10-31 15:56:02 +01:00
Shauren
b95648ae27 Core/Threading: Significantly reduced the severity of possible data race during player login
* This commit changes a data race on a pointer value to data race on integers (guid)

(cherry picked from commit dbe2051056)
2015-10-31 15:41:32 +01:00
Shauren
517a30d7c1 Core/DBLayer: Sprinkle some async magic on worldserver auth/session load process
(cherry picked from commit 0e49eefe85)
2015-10-31 15:36:48 +01:00
ShinDarth
d380c12c56 Core/Battleground: implement deserters tracker feature 2015-10-28 20:39:04 +01:00
pete318
b1032ed620 Change many uint32 to ObjectGuid::LowType in line with 6.x changes. 2015-10-12 23:10:41 +02:00
pete318
cdb16c5181 Rooted vehicle movement (#13342 for example)
Corrects issue where certain combinations of actions would cause vehicles (usually cannons/artillary) that should be rooted, to be fully movable
2015-10-06 22:05:11 +02:00
jackpoz
fcc6ef6b18 Core/DBLayer: Build fix in addition to 25c0303976 2015-09-27 17:19:49 +02:00
pete318
dcb7082277 Map local guids 6.x -> 3.3.35:
Implemented:
  ca83e14f8b
  ee1c1b97be
  18e4ab6911
  bf37446b3c
  cb854a2b7b

* This adds separate (per map) guid sequences depending on object type
* Ported map object container from cmangos/mangos-wotlk@a2d396e
* Added type container visitor for TypeUnorderedMapContainer
* Implemented helper function to erase unique pairs from multimap containers
* Moved object storage of all objects except players and transports to map level
* Added containers linking database spawn id with creature/gameobject in world
* Renamed DBTableGuid to spawnId
* Added a separate spawn id sequence generator for creatures and gameobjects - this will be used in db tables
* Moved building SMSG_UPDATE_OBJECT - updatefields changes broadcast to map update
* Added new function to return but not increment guid
* Adjusted .debug loadcells to show low guid in map before/after load
* Added debug messages for creature spawn/destroy, for map guid debugging
* Store all Gameobjects and Creatures added to OutdoorPvP, so the callback script can be removed when OutdoorPvP instance is destroyed.
2015-09-22 21:33:57 +02:00
jackpoz
b7f9836d22 Core/Dungeon Finder: Remove disconnected players from LFG queue
Fix LFG queue issues by removing disconnected players from LFG queue and their party with them.
2015-09-01 22:33:55 +02:00
jackpoz
f07fe63e50 Core/Threading: Handle CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE only in WorldSession update because it removes the Player from his Group which is not thread-safe 2015-07-28 20:23:18 +02:00
Vincent-Michael
d2d4bc2668 Core: Header cleanup in game/*/*.cpp
(cherry picked from commit 2e586bc520)

Conflicts:
	src/server/game/Battlegrounds/Battleground.cpp
	src/server/game/Battlegrounds/BattlegroundMgr.cpp
	src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp
	src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
	src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp
	src/server/game/Chat/Chat.cpp
	src/server/game/Combat/ThreatManager.cpp
	src/server/game/DataStores/DB2Stores.cpp
	src/server/game/DataStores/DBCStores.cpp
	src/server/game/Entities/Creature/Creature.cpp
	src/server/game/Entities/Creature/GossipDef.cpp
	src/server/game/Entities/Object/Object.cpp
	src/server/game/Entities/Object/ObjectGuid.cpp
	src/server/game/Entities/Object/Updates/UpdateData.cpp
	src/server/game/Entities/Pet/Pet.cpp
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Player/Player.h
	src/server/game/Globals/ObjectAccessor.cpp
	src/server/game/Handlers/BankHandler.cpp
	src/server/game/Handlers/CombatHandler.cpp
	src/server/game/Handlers/GroupHandler.cpp
	src/server/game/Handlers/GuildHandler.cpp
	src/server/game/Handlers/ItemHandler.cpp
	src/server/game/Handlers/MiscHandler.cpp
	src/server/game/Handlers/MovementHandler.cpp
	src/server/game/Handlers/PetitionsHandler.cpp
	src/server/game/Handlers/QueryHandler.cpp
	src/server/game/Handlers/SpellHandler.cpp
	src/server/game/Handlers/TokenHandler.cpp
	src/server/game/Handlers/VoiceChatHandler.cpp
	src/server/game/Maps/Map.cpp
	src/server/game/Movement/Spline/MoveSplineInit.cpp
	src/server/game/Quests/QuestDef.cpp
	src/server/game/Server/Packet.cpp
	src/server/game/Server/Packets/SpellPackets.cpp
	src/server/game/Server/WorldSession.cpp
	src/server/game/Server/WorldSocket.cpp
	src/server/game/Spells/Auras/SpellAuraEffects.cpp
	src/server/game/Spells/Spell.cpp
	src/server/game/Spells/SpellEffects.cpp
	src/server/game/Spells/SpellScript.cpp
	src/server/game/Warden/Warden.cpp
	src/server/game/Warden/WardenWin.cpp
	src/server/game/Weather/WeatherMgr.cpp
2015-07-25 21:53:30 +01:00