Skip to content

Commit

Permalink
Core/Misc: Properly close database connections when using --update-da…
Browse files Browse the repository at this point in the history
…tabases-only arg

(cherry picked from commit a9f9f73)
  • Loading branch information
Shauren committed Jan 6, 2022
1 parent 962a2ac commit c776218
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/server/bnetserver/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ int main(int argc, char** argv)
if (!StartDB())
return 1;

std::shared_ptr<void> dbHandle(nullptr, [](void*) { StopDB(); });

if (vm.count("update-databases-only"))
return 0;

Expand All @@ -167,8 +169,6 @@ int main(int argc, char** argv)
// Load IP Location Database
sIPLocation->Load();

std::shared_ptr<void> dbHandle(nullptr, [](void*) { StopDB(); });

std::shared_ptr<Trinity::Asio::IoContext> ioContext = std::make_shared<Trinity::Asio::IoContext>();

// Start the listening port (acceptor) for auth connections
Expand Down
4 changes: 2 additions & 2 deletions src/server/worldserver/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ extern int main(int argc, char** argv)
if (!StartDB())
return 1;

std::shared_ptr<void> dbHandle(nullptr, [](void*) { StopDB(); });

if (vm.count("update-databases-only"))
return 0;

std::shared_ptr<void> dbHandle(nullptr, [](void*) { StopDB(); });

// Set server offline (not connectable)
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realm.Id.Realm);

Expand Down

0 comments on commit c776218

Please sign in to comment.