1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 14:54:59 +00:00
serenity/Userland/Services/EchoServer/Client.h
Andreas Kling b91c49364d AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +02:00

29 lines
557 B
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibCore/TCPSocket.h>
class Client : public RefCounted<Client> {
public:
static NonnullRefPtr<Client> create(int id, RefPtr<Core::TCPSocket> socket)
{
return adopt_ref(*new Client(id, move(socket)));
}
Function<void()> on_exit;
protected:
Client(int id, RefPtr<Core::TCPSocket> socket);
void drain_socket();
void quit();
private:
int m_id { 0 };
RefPtr<Core::TCPSocket> m_socket;
};