mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 04:37:22 +00:00
LibCore: Remove unused TCPServer constructor parameter
This commit is contained in:
parent
d13884e933
commit
036aa43a41
Notes:
github-actions[bot]
2025-08-11 14:58:02 +00:00
Author: https://github.com/awesomekling
Commit: 036aa43a41
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5817
Reviewed-by: https://github.com/gmta ✅
3 changed files with 10 additions and 12 deletions
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
ErrorOr<NonnullRefPtr<TCPServer>> TCPServer::try_create(EventReceiver* parent)
|
ErrorOr<NonnullRefPtr<TCPServer>> TCPServer::try_create()
|
||||||
{
|
{
|
||||||
#ifdef SOCK_NONBLOCK
|
#ifdef SOCK_NONBLOCK
|
||||||
int fd = TRY(Core::System::socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0));
|
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));
|
TRY(Core::System::fcntl(fd, F_SETFD, FD_CLOEXEC));
|
||||||
#endif
|
#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)
|
TCPServer::TCPServer(int fd)
|
||||||
: EventReceiver(parent)
|
: m_fd(fd)
|
||||||
, m_fd(fd)
|
|
||||||
{
|
{
|
||||||
VERIFY(m_fd >= 0);
|
VERIFY(m_fd >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Core {
|
||||||
class TCPServer : public EventReceiver {
|
class TCPServer : public EventReceiver {
|
||||||
C_OBJECT_ABSTRACT(TCPServer)
|
C_OBJECT_ABSTRACT(TCPServer)
|
||||||
public:
|
public:
|
||||||
static ErrorOr<NonnullRefPtr<TCPServer>> try_create(EventReceiver* parent = nullptr);
|
static ErrorOr<NonnullRefPtr<TCPServer>> try_create();
|
||||||
virtual ~TCPServer() override;
|
virtual ~TCPServer() override;
|
||||||
|
|
||||||
enum class AllowAddressReuse {
|
enum class AllowAddressReuse {
|
||||||
|
@ -36,7 +36,7 @@ public:
|
||||||
Function<void()> on_ready_to_accept;
|
Function<void()> on_ready_to_accept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit TCPServer(int fd, EventReceiver* parent = nullptr);
|
explicit TCPServer(int fd);
|
||||||
|
|
||||||
int m_fd { -1 };
|
int m_fd { -1 };
|
||||||
bool m_listening { false };
|
bool m_listening { false };
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
namespace Core {
|
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));
|
int fd = TRY(Core::System::socket(AF_INET, SOCK_STREAM, 0));
|
||||||
ArmedScopeGuard close_fd { [fd]() {
|
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)
|
if (SetHandleInformation(to_handle(fd), HANDLE_FLAG_INHERIT, 0) == 0)
|
||||||
return Error::from_windows_error();
|
return Error::from_windows_error();
|
||||||
close_fd.disarm();
|
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)
|
TCPServer::TCPServer(int fd)
|
||||||
: EventReceiver(parent)
|
: m_fd(fd)
|
||||||
, m_fd(fd)
|
|
||||||
{
|
{
|
||||||
VERIFY(m_fd >= 0);
|
VERIFY(m_fd >= 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue