A lot of updates

This commit is contained in:
WolverinDEV
2020-02-01 14:32:16 +01:00
parent fe05c63882
commit 543e6b1abc
44 changed files with 714 additions and 392 deletions
+4 -5
View File
@@ -602,13 +602,12 @@ command_result SpeakingClient::handleCommandClientInit(Command& cmd) {
this->postCommandHandler.emplace_back([&](){
auto self = dynamic_pointer_cast<SpeakingClient>(_this.lock());
std::thread([self](){
threads::MutexLock l1(self->disconnectLock);
if(self->state != ConnectionState::INIT_HIGH) return;
try {
self->processJoin();
} catch (std::exception& ex) {
logError(self->getServerId(), "Failed to proceed client join for {}. Got exception with message {}", CLIENT_STR_LOG_PREFIX_(self), ex.what());
self->closeConnection();
self->close_connection(chrono::system_clock::now() + chrono::seconds{5});
}
}).detach();
});
@@ -670,7 +669,7 @@ void SpeakingClient::processJoin() {
auto result = command_result{error::vs_critical, "Could not assign default channel!"};
this->notifyError(result);
result.release_details();
this->closeConnection(system_clock::now() + seconds(1));
this->close_connection(system_clock::now() + seconds(1));
return;
}
TIMING_STEP(timings, "assign chan");
@@ -767,7 +766,7 @@ void SpeakingClient::tick(const std::chrono::system_clock::time_point &time) {
auto max_idle = this->max_idle_time.value;
if(max_idle > 0 && this->idleTimestamp.time_since_epoch().count() > 0 && duration_cast<seconds>(time - this->idleTimestamp).count() > max_idle) {
this->server->notify_client_kick(this->ref(), this->server->getServerRoot(), ts::config::messages::idle_time_exceeded, nullptr);
this->closeConnection(system_clock::now() + seconds(1));
this->close_connection(system_clock::now() + seconds(1));
}
}
@@ -792,7 +791,7 @@ command_result SpeakingClient::handleCommand(Command &command) {
if(result.error_code())
this->postCommandHandler.push_back([&]{
this->closeConnection(system_clock::now() + seconds(1));
this->close_connection(system_clock::now() + seconds(1));
});
return result;
}