blob: 6a1478fa1e9d1b7bdb4643f90817ef11b7f245c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibCore/Stream.h>
class Client : public RefCounted<Client> {
public:
static NonnullRefPtr<Client> create(int id, NonnullOwnPtr<Core::Stream::TCPSocket> socket)
{
return adopt_ref(*new Client(id, move(socket)));
}
Function<void()> on_exit;
protected:
Client(int id, NonnullOwnPtr<Core::Stream::TCPSocket> socket);
ErrorOr<void> drain_socket();
void quit();
private:
int m_id { 0 };
NonnullOwnPtr<Core::Stream::TCPSocket> m_socket;
};
|