LibCore: Remove unused TCPServer constructor parameter

This commit is contained in:
Andreas Kling 2025-08-10 16:26:49 +02:00 committed by Andreas Kling
commit 036aa43a41
Notes: github-actions[bot] 2025-08-11 14:58:02 +00:00
3 changed files with 10 additions and 12 deletions

View file

@ -14,7 +14,7 @@
namespace Core {
ErrorOr<NonnullRefPtr<TCPServer>> TCPServer::try_create(EventReceiver* parent)
ErrorOr<NonnullRefPtr<TCPServer>> TCPServer::try_create()
{
#ifdef SOCK_NONBLOCK
int fd = TRY(Core::System::socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0));
@ -25,12 +25,11 @@ ErrorOr<NonnullRefPtr<TCPServer>> TCPServer::try_create(EventReceiver* parent)
TRY(Core::System::fcntl(fd, F_SETFD, FD_CLOEXEC));
#endif
return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd, parent));
return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd));
}
TCPServer::TCPServer(int fd, EventReceiver* parent)
: EventReceiver(parent)
, m_fd(fd)
TCPServer::TCPServer(int fd)
: m_fd(fd)
{
VERIFY(m_fd >= 0);
}

View file

@ -16,7 +16,7 @@ namespace Core {
class TCPServer : public EventReceiver {
C_OBJECT_ABSTRACT(TCPServer)
public:
static ErrorOr<NonnullRefPtr<TCPServer>> try_create(EventReceiver* parent = nullptr);
static ErrorOr<NonnullRefPtr<TCPServer>> try_create();
virtual ~TCPServer() override;
enum class AllowAddressReuse {
@ -36,7 +36,7 @@ public:
Function<void()> on_ready_to_accept;
private:
explicit TCPServer(int fd, EventReceiver* parent = nullptr);
explicit TCPServer(int fd);
int m_fd { -1 };
bool m_listening { false };

View file

@ -15,7 +15,7 @@
namespace Core {
ErrorOr<NonnullRefPtr<TCPServer>> TCPServer::try_create(EventReceiver* parent)
ErrorOr<NonnullRefPtr<TCPServer>> TCPServer::try_create()
{
int fd = TRY(Core::System::socket(AF_INET, SOCK_STREAM, 0));
ArmedScopeGuard close_fd { [fd]() {
@ -28,12 +28,11 @@ ErrorOr<NonnullRefPtr<TCPServer>> TCPServer::try_create(EventReceiver* parent)
if (SetHandleInformation(to_handle(fd), HANDLE_FLAG_INHERIT, 0) == 0)
return Error::from_windows_error();
close_fd.disarm();
return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd, parent));
return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd));
}
TCPServer::TCPServer(int fd, EventReceiver* parent)
: EventReceiver(parent)
, m_fd(fd)
TCPServer::TCPServer(int fd)
: m_fd(fd)
{
VERIFY(m_fd >= 0);
}