mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 22:49:47 +00:00
LibCore: Implement TCPServer on Windows
This commit is contained in:
parent
9d7971c111
commit
cc3cabc768
Notes:
github-actions[bot]
2025-08-07 02:26:27 +00:00
Author: https://github.com/ayeteadoe
Commit: cc3cabc768
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5435
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/R-Goc
5 changed files with 174 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
|||
* Copyright (c) 2018-2021, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
|
||||
* Copyright (c) 2025, stasoid <stasoid@yahoo.com>
|
||||
* Copyright (c) 2025, ayeteadoe <ayeteadoe@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -279,4 +280,15 @@ ErrorOr<NonnullOwnPtr<TCPSocket>> TCPSocket::connect(SocketAddress const& addres
|
|||
return socket;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<TCPSocket>> TCPSocket::adopt_fd(int fd)
|
||||
{
|
||||
if (static_cast<SOCKET>(fd) == INVALID_SOCKET)
|
||||
return Error::from_windows_error();
|
||||
|
||||
auto socket = TRY(adopt_nonnull_own_or_enomem(new (nothrow) TCPSocket()));
|
||||
socket->m_helper.set_fd(fd);
|
||||
socket->setup_notifier();
|
||||
return socket;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue