mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-22 23:25:39 +01:00
Enable the use of MSG_DONTWAIT flag on RecvImpl
This commit is contained in:
parent
93a4ca11fa
commit
912cae21b0
@ -720,7 +720,25 @@ std::pair<s32, Errno> BSD::RecvImpl(s32 fd, u32 flags, std::vector<u8>& message)
|
|||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
}
|
}
|
||||||
return Translate(file_descriptors[fd]->socket->Recv(flags, message));
|
|
||||||
|
FileDescriptor& descriptor = *file_descriptors[fd];
|
||||||
|
|
||||||
|
// Apply flags
|
||||||
|
if ((flags & FLAG_MSG_DONTWAIT) != 0) {
|
||||||
|
flags &= ~FLAG_MSG_DONTWAIT;
|
||||||
|
if ((descriptor.flags & FLAG_O_NONBLOCK) == 0) {
|
||||||
|
descriptor.socket->SetNonBlock(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto [ret, bsd_errno] = Translate(descriptor.socket->Recv(flags, message));
|
||||||
|
|
||||||
|
// Restore original state
|
||||||
|
if ((descriptor.flags & FLAG_O_NONBLOCK) == 0) {
|
||||||
|
descriptor.socket->SetNonBlock(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {ret, bsd_errno};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& message,
|
std::pair<s32, Errno> BSD::RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& message,
|
||||||
|
Loading…
Reference in New Issue
Block a user