/[inetutils]/inetutils/ping/ping.c
ViewVC logotype

Diff of /inetutils/ping/ping.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by gray, Sat Apr 5 16:43:51 2003 UTC revision 1.16 by gray, Mon Apr 21 14:18:59 2003 UTC
# Line 345  ping_run (PING *ping, int (*finish)()) Line 345  ping_run (PING *ping, int (*finish)())
345    struct timeval last, intvl, now;    struct timeval last, intvl, now;
346    struct timeval *t = NULL;    struct timeval *t = NULL;
347    int finishing = 0;    int finishing = 0;
348        int nresp = 0;
349    
350    signal (SIGINT, sig_int);    signal (SIGINT, sig_int);
351        
352    fdmax = ping->ping_fd+1;    fdmax = ping->ping_fd+1;
# Line 399  ping_run (PING *ping, int (*finish)()) Line 400  ping_run (PING *ping, int (*finish)())
400          }          }
401        else if (n == 1)        else if (n == 1)
402          {          {
403            len = ping_recv (ping);            if (ping_recv (ping) == 0)
404                nresp++;
405            if (t == 0)            if (t == 0)
406              {              {
407                gettimeofday (&now, NULL);                gettimeofday (&now, NULL);
408                t = &now;                t = &now;
409              }              }
410            if (ping->ping_count && ping->ping_num_xmit >= ping->ping_count)            if (ping->ping_count && nresp >= ping->ping_count)
             {  
               struct timeval tmp = last;  
               tmp.tv_sec += 10; /* FIXME: should I make it configurable? */  
               if (timercmp (&tmp, &now, <=))  
411              break;              break;
412          }          }
         }  
413        else        else
414          {          {
415            if (!ping->ping_count || ping->ping_num_xmit < ping->ping_count)            if (!ping->ping_count || ping->ping_num_xmit < ping->ping_count)
# Line 426  ping_run (PING *ping, int (*finish)()) Line 423  ping_run (PING *ping, int (*finish)())
423            else if (finishing)            else if (finishing)
424              break;              break;
425            else            else
426              {              {
427                finishing = 1;                finishing = 1;
428    
429                intvl.tv_sec = MAXWAIT;                intvl.tv_sec = MAXWAIT;

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26