Commit d2062f52 by Pascal Obry Committed by Arnaud Charlet

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
parent 6c994759
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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment