diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-22 08:53:05 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-22 08:53:05 +0000 |
commit | 7bd3442e1fb3e85658433cddaee133005d1d3eca (patch) | |
tree | f99a7a2bc2c602c39026b12bd0201e92ddb16422 /gcc/ada/g-socthi-mingw.adb | |
parent | ae1bba3e7a1b3e661b894caca86181a8ae475dac (diff) | |
download | gcc-7bd3442e1fb3e85658433cddaee133005d1d3eca.tar.gz |
2010-06-22 Pascal Obry <obry@adacore.com>
* g-socthi-mingw.adb: Properly honor MSG_WAITALL in recvmsg.
(C_Recvmsg): Propely honor the MSG_WAITALL flag in Windows
recvmsg emulation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161149 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socthi-mingw.adb')
-rw-r--r-- | gcc/ada/g-socthi-mingw.adb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb index 6d7ca23f0b8..f1c8edd1e1c 100644 --- a/gcc/ada/g-socthi-mingw.adb +++ b/gcc/ada/g-socthi-mingw.adb @@ -276,6 +276,10 @@ package body GNAT.Sockets.Thin is is use type C.size_t; + Fill : constant Boolean := + (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0; + -- Is the MSG_WAITALL flag set? If so we need to fully fill all vectors + Res : C.int; Count : C.int := 0; @@ -327,7 +331,7 @@ package body GNAT.Sockets.Thin is if Res < 0 then return System.CRTL.ssize_t (Res); - elsif Res = 0 then + elsif Res = 0 and then not Fill then exit; else @@ -342,9 +346,16 @@ package body GNAT.Sockets.Thin is -- If all the data that was initially available read, do not -- attempt to receive more, since this might block, or merge data - -- from successive datagrams for a datagram-oriented socket. - - exit when Natural (Count) >= Req.Size; + -- from successive datagrams for a datagram-oriented + -- socket. We still try to receive more if we need to fill all + -- vectors (MSG_WAITALL flag is set). + + exit when Natural (Count) >= Req.Size + and then + (not Fill -- either we are not in fill mode + or else -- or last vector filled + (Interfaces.C.size_t (Iov_Index) = Iovec'Last + and then Current_Iovec.Length = 0)); end if; end loop; |