diff options
author | Link4565 <49906383+Link4565@users.noreply.github.com> | 2022-06-28 21:29:41 +0200 |
---|---|---|
committer | Link4565 <49906383+Link4565@users.noreply.github.com> | 2022-07-16 19:30:28 +0200 |
commit | 912cae21b070e6f5972ce34a08b25e4ae2182d5c (patch) | |
tree | 49f2296ef15ec830a8864a608c4e3c0412a414e0 /src/core/hle/service/sockets | |
parent | Merge pull request #8560 from liamwhite/bitfield-may-alias (diff) | |
download | yuzu-912cae21b070e6f5972ce34a08b25e4ae2182d5c.tar yuzu-912cae21b070e6f5972ce34a08b25e4ae2182d5c.tar.gz yuzu-912cae21b070e6f5972ce34a08b25e4ae2182d5c.tar.bz2 yuzu-912cae21b070e6f5972ce34a08b25e4ae2182d5c.tar.lz yuzu-912cae21b070e6f5972ce34a08b25e4ae2182d5c.tar.xz yuzu-912cae21b070e6f5972ce34a08b25e4ae2182d5c.tar.zst yuzu-912cae21b070e6f5972ce34a08b25e4ae2182d5c.zip |
Diffstat (limited to 'src/core/hle/service/sockets')
-rw-r--r-- | src/core/hle/service/sockets/bsd.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 5114b8be2..3e9dc4a13 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -720,7 +720,25 @@ std::pair<s32, Errno> BSD::RecvImpl(s32 fd, u32 flags, std::vector<u8>& message) if (!IsFileDescriptorValid(fd)) { 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, |