don't allow *this to be destroyed too early on idle timeout
This commit is contained in:
+2
-1
@@ -245,7 +245,8 @@ void Client::idle_timeout() {
|
|||||||
this->log.info("Idle timeout expired");
|
this->log.info("Idle timeout expired");
|
||||||
auto s = this->server.lock();
|
auto s = this->server.lock();
|
||||||
if (s) {
|
if (s) {
|
||||||
s->disconnect_client(this->shared_from_this());
|
auto c = this->shared_from_this();
|
||||||
|
s->disconnect_client(c);
|
||||||
} else {
|
} else {
|
||||||
this->log.info("Server is deleted; cannot disconnect client");
|
this->log.info("Server is deleted; cannot disconnect client");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user