net: convert standalone SetSocketNonBlocking() to Sock::SetNonBlocking()

This further encapsulates syscalls inside the `Sock` class.

Co-authored-by: practicalswift <practicalswift@users.noreply.github.com>
This commit is contained in:
Vasil Dimov
2021-04-19 11:35:09 +02:00
parent 29f66f7682
commit b527b54950
6 changed files with 37 additions and 14 deletions

View File

@@ -254,6 +254,19 @@ int FuzzedSock::GetSockName(sockaddr* name, socklen_t* name_len) const
return 0;
}
bool FuzzedSock::SetNonBlocking() const
{
constexpr std::array setnonblocking_errnos{
EBADF,
EPERM,
};
if (m_fuzzed_data_provider.ConsumeBool()) {
SetFuzzedErrNo(m_fuzzed_data_provider, setnonblocking_errnos);
return false;
}
return true;
}
bool FuzzedSock::IsSelectable() const
{
return m_selectable;