mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-23 16:40:03 +00:00
Tests/LibCore: Enable TestLibCoreStream in Windows CI
This commit is contained in:
parent
e01a95f6cd
commit
688d0ada97
Notes:
github-actions[bot]
2025-08-07 02:25:42 +00:00
Author: https://github.com/ayeteadoe
Commit: 688d0ada97
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 89 additions and 38 deletions
|
@ -116,9 +116,9 @@ ErrorOr<size_t> PosixSocketHelper::pending_bytes() const
|
|||
return Error::from_windows_error(WSAENOTCONN);
|
||||
}
|
||||
|
||||
int value;
|
||||
u_long value;
|
||||
TRY(System::ioctl(m_fd, FIONREAD, &value));
|
||||
return static_cast<size_t>(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
void PosixSocketHelper::setup_notifier()
|
||||
|
@ -310,6 +310,21 @@ ErrorOr<NonnullOwnPtr<UDPSocket>> UDPSocket::connect(SocketAddress const& addres
|
|||
return socket;
|
||||
}
|
||||
|
||||
ErrorOr<Bytes> UDPSocket::read_some(Bytes buffer)
|
||||
{
|
||||
auto pending_bytes = TRY(this->pending_bytes());
|
||||
if (pending_bytes > buffer.size()) {
|
||||
// With UDP datagrams, reading a datagram into a buffer that's
|
||||
// smaller than the datagram's size will cause the rest of the
|
||||
// datagram to be discarded. That's not very nice, so let's bail
|
||||
// early, telling the caller that he should allocate a bigger
|
||||
// buffer.
|
||||
return Error::from_errno(WSAEMSGSIZE);
|
||||
}
|
||||
|
||||
return m_helper.read(buffer, default_flags());
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<TCPSocket>> TCPSocket::connect(ByteString const& host, u16 port)
|
||||
{
|
||||
auto ip_addresses = TRY(resolve_host(host, SocketType::Stream));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue