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
Notes:
sideshowbarker
2024-07-19 09:31:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/fc85d173226
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()
|
||||
{
|
||||
NonnullRefPtr<Client> protect(*this);
|
||||
while (m_socket->can_read()) {
|
||||
auto buf = m_socket->read(1024);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue