mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-17 12:01:22 +00:00
Add try catch around packet handling for sql error
This commit is contained in:
parent
a580e3a2f5
commit
05c67fd712
@ -17,7 +17,7 @@ __dynamic=1
|
||||
# Set __compile_backtrace__ to 1 to compile the backtrace library instead of using system libraries.
|
||||
# __compile_backtrace__=1
|
||||
# Set to the number of jobs (make -j equivalent) to compile the mariadbconn files with.
|
||||
__maria_db_connector_compile_jobs__=1
|
||||
__maria_db_connector_compile_jobs__=
|
||||
# When set to 1 and uncommented, compiling and linking testing folders and libraries will be done.
|
||||
__enable_testing__=1
|
||||
# The path to OpenSSL. Change this if your OpenSSL install path is different than the default.
|
||||
|
2
build.sh
2
build.sh
@ -9,5 +9,5 @@ cd build
|
||||
cmake ..
|
||||
|
||||
# To build utilizing multiple cores, append `-j` and the amount of cores to utilize, for example `cmake --build . --config Release -j8'
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config Release -j
|
||||
|
||||
|
@ -42,7 +42,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
Entity* entity = EntityManager::Instance()->GetEntity(objectID);
|
||||
|
||||
User* usr = UserManager::Instance()->GetUser(sysAddr);
|
||||
|
||||
Game::logger->Log("GameMessageHandler", "handling message %i", messageID);
|
||||
if (!entity) {
|
||||
Game::logger->Log("GameMessageHandler", "Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);
|
||||
|
||||
|
@ -413,22 +413,28 @@ int main(int argc, char** argv) {
|
||||
|
||||
UserManager::Instance()->DeletePendingRemovals();
|
||||
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
for (uint32_t curPacket = 0; curPacket < maxPacketsToProcess && timeSpent < maxPacketProcessingTime; curPacket++) {
|
||||
packet = Game::server->Receive();
|
||||
if (packet) {
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
HandlePacket(packet);
|
||||
auto t2 = std::chrono::high_resolution_clock::now();
|
||||
try {
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
for (uint32_t curPacket = 0; curPacket < maxPacketsToProcess && timeSpent < maxPacketProcessingTime; curPacket++) {
|
||||
packet = Game::server->Receive();
|
||||
if (packet) {
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
HandlePacket(packet);
|
||||
auto t2 = std::chrono::high_resolution_clock::now();
|
||||
|
||||
timeSpent += std::chrono::duration_cast<std::chrono::duration<float>>(t2 - t1).count();
|
||||
Game::server->DeallocatePacket(packet);
|
||||
packet = nullptr;
|
||||
} else {
|
||||
break;
|
||||
timeSpent += std::chrono::duration_cast<std::chrono::duration<float>>(t2 - t1).count();
|
||||
Game::server->DeallocatePacket(packet);
|
||||
packet = nullptr;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (sql::SQLException& e) {
|
||||
Game::logger->Log("WorldServer", "Caught an error (%s)", e.what());
|
||||
std::raise(SIGTERM);
|
||||
}
|
||||
|
||||
|
||||
Metrics::EndMeasurement(MetricVariable::PacketHandling);
|
||||
|
||||
Metrics::StartMeasurement(MetricVariable::UpdateReplica);
|
||||
|
Loading…
x
Reference in New Issue
Block a user