Fixed some errors related to disconnecting
This commit is contained in:
parent
9649135f43
commit
65436429b8
7 changed files with 119 additions and 56 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include "Server/CommandList.hpp"
|
||||
#include <chrono>
|
||||
#include "World.hpp"
|
||||
#include <Helpers/Logger.hpp>
|
||||
|
||||
void ConnectionManager::init_local_p2p(World& initWorld, const std::string& serverLocalID) {
|
||||
localServer = std::make_unique<MainServer>(initWorld, serverLocalID);
|
||||
|
|
@ -18,8 +19,9 @@ void ConnectionManager::connect_p2p(World& initWorld, const std::string& serverF
|
|||
}
|
||||
|
||||
void ConnectionManager::update() {
|
||||
if(localServer)
|
||||
if(localServer) {
|
||||
localServer->update();
|
||||
}
|
||||
if(client) {
|
||||
client->update();
|
||||
if(std::chrono::steady_clock::now() - lastKeepAliveTime > std::chrono::seconds(2)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue