public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2115] [Ada] Timeout correction on Get_Socket_Option
@ 2021-07-07 16:25 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-07 16:25 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:4fa7097a140f007f86e81f62cd08fff15b16ef6e
commit r12-2115-g4fa7097a140f007f86e81f62cd08fff15b16ef6e
Author: Dmitriy Anisimkov <anisimko@adacore.com>
Date: Wed May 19 18:26:16 2021 +0600
[Ada] Timeout correction on Get_Socket_Option
gcc/ada/
* libgnat/g-socket.adb (Get_Socket_Option): Add 500ms only when
Minus_500ms_Windows_Timeout is True.
(Set_Socket_Option): Use "* 1000" instead of "/ 0.001" to
convert to milliseconds.
Diff:
---
gcc/ada/libgnat/g-socket.adb | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/libgnat/g-socket.adb b/gcc/ada/libgnat/g-socket.adb
index a246303cb66..75a2b27414f 100644
--- a/gcc/ada/libgnat/g-socket.adb
+++ b/gcc/ada/libgnat/g-socket.adb
@@ -1570,14 +1570,18 @@ package body GNAT.Sockets is
| Send_Timeout
=>
if Is_Windows then
-
- -- Timeout is in milliseconds, actual value is 500 ms +
- -- returned value (unless it is 0).
-
if U4 = 0 then
Opt.Timeout := 0.0;
+
else
- Opt.Timeout := Duration (U4) / 1000 + 0.500;
+ if Minus_500ms_Windows_Timeout then
+ -- Timeout is in milliseconds, actual value is 500 ms +
+ -- returned value (unless it is 0).
+
+ U4 := U4 + 500;
+ end if;
+
+ Opt.Timeout := Duration (U4) / 1000;
end if;
else
@@ -2724,7 +2728,7 @@ package body GNAT.Sockets is
Len := U4'Size / 8;
Add := U4'Address;
- U4 := C.unsigned (Option.Timeout / 0.001);
+ U4 := C.unsigned (Option.Timeout * 1000);
if Option.Timeout > 0.0 and then U4 = 0 then
-- Avoid round to zero. Zero timeout mean unlimited
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-07 16:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 16:25 [gcc r12-2115] [Ada] Timeout correction on Get_Socket_Option Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).