aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPascal Obry <obry@adacore.com>2010-06-22 08:53:05 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-22 10:53:05 +0200
commitd2062f520382da129b9e4b5f5aca71c7d66d6c25 (patch)
treef99a7a2bc2c602c39026b12bd0201e92ddb16422 /gcc
parent6c994759f3581d979a57ce31cfab10cd5329bb44 (diff)
downloadgcc-d2062f520382da129b9e4b5f5aca71c7d66d6c25.zip
gcc-d2062f520382da129b9e4b5f5aca71c7d66d6c25.tar.gz
gcc-d2062f520382da129b9e4b5f5aca71c7d66d6c25.tar.bz2
g-socthi-mingw.adb: Properly honor MSG_WAITALL in recvmsg.
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. From-SVN: r161149
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/g-socthi-mingw.adb19
2 files changed, 21 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 01b0076..94c025b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2010-06-22 Robert Dewar <dewar@adacore.com>
* sem_ch4.adb (Analyze_Conditional_Expression): Defend against
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb
index 6d7ca23..f1c8edd 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;