1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:47:34 +00:00

LibCore: Move Stream-based sockets into the Core namespace

This commit is contained in:
Tim Schumacher 2023-02-08 23:05:44 +01:00 committed by Linus Groh
parent d43a7eae54
commit a96339b72b
123 changed files with 1157 additions and 1100 deletions

View file

@ -14,10 +14,11 @@
#include <AK/Types.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Notifier.h>
#include <LibCore/Socket.h>
#include <stdio.h>
#include <unistd.h>
Client::Client(int id, NonnullOwnPtr<Core::Stream::TCPSocket> socket, int ptm_fd)
Client::Client(int id, NonnullOwnPtr<Core::TCPSocket> socket, int ptm_fd)
: m_id(id)
, m_socket(move(socket))
, m_ptm_fd(ptm_fd)
@ -51,7 +52,7 @@ Client::Client(int id, NonnullOwnPtr<Core::Stream::TCPSocket> socket, int ptm_fd
m_parser.on_error = [this]() { handle_error(); };
}
ErrorOr<NonnullRefPtr<Client>> Client::create(int id, NonnullOwnPtr<Core::Stream::TCPSocket> socket, int ptm_fd)
ErrorOr<NonnullRefPtr<Client>> Client::create(int id, NonnullOwnPtr<Core::TCPSocket> socket, int ptm_fd)
{
auto client = adopt_ref(*new Client(id, move(socket), ptm_fd));

View file

@ -17,12 +17,12 @@
class Client : public RefCounted<Client> {
public:
static ErrorOr<NonnullRefPtr<Client>> create(int id, NonnullOwnPtr<Core::Stream::TCPSocket> socket, int ptm_fd);
static ErrorOr<NonnullRefPtr<Client>> create(int id, NonnullOwnPtr<Core::TCPSocket> socket, int ptm_fd);
Function<void()> on_exit;
private:
Client(int id, NonnullOwnPtr<Core::Stream::TCPSocket> socket, int ptm_fd);
Client(int id, NonnullOwnPtr<Core::TCPSocket> socket, int ptm_fd);
ErrorOr<void> drain_socket();
ErrorOr<void> drain_pty();
@ -38,7 +38,7 @@ private:
// client id
int m_id { 0 };
// client resources
NonnullOwnPtr<Core::Stream::TCPSocket> m_socket;
NonnullOwnPtr<Core::TCPSocket> m_socket;
Parser m_parser;
// pty resources
int m_ptm_fd { -1 };

View file

@ -11,6 +11,7 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Socket.h>
#include <LibCore/TCPServer.h>
#include <LibMain/Main.h>
#include <fcntl.h>