mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
TelnetServer: Protect the Client object during drain_socket()
If parsing a command causes us to disconnect the client, we have to defer deletion of the Client object until we're done with the socket.
This commit is contained in:
parent
deb154be61
commit
fc85d17322
1 changed files with 1 additions and 0 deletions
|
@ -57,6 +57,7 @@ Client::Client(int id, RefPtr<Core::TCPSocket> socket, int ptm_fd)
|
||||||
|
|
||||||
void Client::drain_socket()
|
void Client::drain_socket()
|
||||||
{
|
{
|
||||||
|
NonnullRefPtr<Client> protect(*this);
|
||||||
while (m_socket->can_read()) {
|
while (m_socket->can_read()) {
|
||||||
auto buf = m_socket->read(1024);
|
auto buf = m_socket->read(1024);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue