Using this->ref() and this->weak_ref() instead of direct member access
This commit is contained in:
@@ -117,7 +117,7 @@ command_result SpeakingClient::handleCommandClientInit(Command& cmd) {
|
||||
}
|
||||
TIMING_STEP(timings, "join atmp c");
|
||||
|
||||
if(!DatabaseHelper::assignDatabaseId(this->server->getSql(), this->server->getServerId(), _this.lock())) {
|
||||
if(!DatabaseHelper::assignDatabaseId(this->server->getSql(), this->server->getServerId(), this->ref())) {
|
||||
return command_result{error::vs_critical, "Could not assign database id!"};
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ command_result SpeakingClient::handleCommandClientInit(Command& cmd) {
|
||||
}
|
||||
|
||||
this->postCommandHandler.emplace_back([&](){
|
||||
auto self = dynamic_pointer_cast<SpeakingClient>(_this.lock());
|
||||
auto self = dynamic_pointer_cast<SpeakingClient>(this->ref());
|
||||
std::thread([self](){
|
||||
if(self->state != ConnectionState::INIT_HIGH) return;
|
||||
try {
|
||||
@@ -411,7 +411,7 @@ void SpeakingClient::processJoin() {
|
||||
}
|
||||
|
||||
TIMING_STEP(timings, "setup ");
|
||||
ref_server->registerClient(_this.lock());
|
||||
ref_server->registerClient(this->ref());
|
||||
{
|
||||
if(this->rtc_client_id) {
|
||||
/* in case of client reconnect */
|
||||
@@ -438,7 +438,7 @@ void SpeakingClient::processJoin() {
|
||||
TIMING_STEP(timings, "server reg ");
|
||||
ref_server->getGroupManager()->cleanupAssignments(this->getClientDatabaseId());
|
||||
TIMING_STEP(timings, "grp cleanup");
|
||||
ref_server->getGroupManager()->update_server_group_property(_this.lock(), true, nullptr);
|
||||
ref_server->getGroupManager()->update_server_group_property(this->ref(), true, nullptr);
|
||||
TIMING_STEP(timings, "grp apply ");
|
||||
|
||||
this->properties()[property::CLIENT_COUNTRY] = config::geo::countryFlag;
|
||||
@@ -537,7 +537,7 @@ void SpeakingClient::processJoin() {
|
||||
}
|
||||
|
||||
void SpeakingClient::processLeave() {
|
||||
auto ownLock = _this.lock();
|
||||
auto ownLock = this->ref();
|
||||
auto server = this->getServer();
|
||||
|
||||
auto channel = this->currentChannel;
|
||||
|
||||
Reference in New Issue
Block a user