[ros-diffs] [gedmurphy] 20387: display correct Min RTT

gedmurphy at svn.reactos.com gedmurphy at svn.reactos.com
Wed Dec 28 02:08:16 CET 2005


display correct Min RTT
Fixes bug 1194
Modified: trunk/reactos/apps/utils/net/ping/ping.c
  _____  

Modified: trunk/reactos/apps/utils/net/ping/ping.c
--- trunk/reactos/apps/utils/net/ping/ping.c	2005-12-28 00:17:21 UTC
(rev 20386)
+++ trunk/reactos/apps/utils/net/ping/ping.c	2005-12-28 01:08:04 UTC
(rev 20387)
@@ -1,5 +1,4 @@

-/* $Id$
- *
+/*
  * COPYRIGHT:   See COPYING in the top level directory
  * PROJECT:     ReactOS ping utility
  * FILE:        apps/net/ping/ping.c
@@ -8,18 +7,15 @@
  * REVISIONS:
  *   CSH  01/09/2000 Created
  */
-//#include <windows.h>
+
 #include <winsock2.h>
 #include <tchar.h>
 #include <stdarg.h>
 #include <string.h>
 #include <stdio.h>
+
 #ifndef _MSC_VER
 
-#ifdef DBG
-#undef DBG
-#endif
-
 /* FIXME: Where should this be? */
 #ifdef CopyMemory
 #undef CopyMemory
@@ -35,9 +31,12 @@
 
 char * _i64toa(__int64 value, char *string, int radix);
 
+#endif /* _MSC_VER */
+
+#ifdef DBG
+#undef DBG
 #endif
 
-
 /* General ICMP constants */
 #define ICMP_MINSIZE		8		/* Minimum ICMP packet
size */
 #define ICMP_MAXSIZE		65535	/* Maximum ICMP packet size */
@@ -453,12 +452,13 @@
 
     printf("Reply from %s: bytes=%d time%s%s TTL=%d\n",
inet_ntoa(from->sin_addr),
       size - IphLength - sizeof(ICMP_ECHO_PACKET), Sign, Time,
IpHeader->TTL);
-    if (RelativeTime.QuadPart < MinRTT.QuadPart) {
-		  MinRTT.QuadPart = RelativeTime.QuadPart;
-      MinRTTSet = TRUE;
+    if (RelativeTime.QuadPart < MinRTT.QuadPart || !MinRTTSet) {
+	    MinRTT.QuadPart = RelativeTime.QuadPart;
+        MinRTTSet = TRUE;
     }
-	  if (RelativeTime.QuadPart > MaxRTT.QuadPart)
-	      MaxRTT.QuadPart = RelativeTime.QuadPart;
+	if (RelativeTime.QuadPart > MaxRTT.QuadPart)
+	    MaxRTT.QuadPart = RelativeTime.QuadPart;
+
     SumRTT.QuadPart += RelativeTime.QuadPart;
 
 	return TRUE;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051228/339d4853/attachment.html


More information about the Ros-diffs mailing list