LibCore: Implement PosixSocketHelper::pending_bytes() on Windows

This commit is contained in:
ayeteadoe 2025-07-14 15:24:00 -07:00 committed by Andrew Kaster
commit ba15348d56
Notes: github-actions[bot] 2025-08-07 02:25:53 +00:00

View file

@ -112,7 +112,13 @@ ErrorOr<void> PosixSocketHelper::set_receive_timeout(AK::Duration timeout)
ErrorOr<size_t> PosixSocketHelper::pending_bytes() const ErrorOr<size_t> PosixSocketHelper::pending_bytes() const
{ {
VERIFY(0 && "Core::PosixSocketHelper::pending_bytes is not implemented"); if (!is_open()) {
return Error::from_windows_error(WSAENOTCONN);
}
int value;
TRY(System::ioctl(m_fd, FIONREAD, &value));
return static_cast<size_t>(value);
} }
void PosixSocketHelper::setup_notifier() void PosixSocketHelper::setup_notifier()