char *get_host_by_address( struct in_addr in );
int in_cksum( u_short *p, int n );
void u_sleep( int u_sec );
-int recvfrom_wto ( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo );
+int recvfrom_wto ( int s, char *buf, int len, FPING_SOCKADDR *saddr, long timo );
void remove_job( HOST_ENTRY *h );
int send_ping( int s, HOST_ENTRY *h );
long timeval_diff( struct timeval *a, struct timeval *b );
void timeval_add(struct timeval *a, long t_10u);
void usage( void );
-int wait_for_reply( u_int );
+int wait_for_reply( long );
void print_per_system_stats( void );
void print_per_system_splits( void );
void print_global_stats( void );
/* main loop */
main_loop();
-
+
finish();
return 0;
void main_loop()
{
- u_int lt;
+ long lt;
long wait_time;
HOST_ENTRY *h;
}
else {
wait_time = timeval_diff(&ev_first->ev_time, ¤t_time);
- if(wait_time < (long) interval) {
- wait_time = interval;
+ if(wait_time < 0) wait_time = 0;
+ if(wait_time < interval) {
+ if(ev_first->ev_type == EV_TYPE_PING) {
+ /* make sure that we wait enough, so that the inter-ping delay is
+ * bigger than 'interval' */
+ lt = timeval_diff(¤t_time, &last_send_time);
+ if(lt > wait_time) {
+ wait_time = lt;
+ }
+ }
}
}
#ifdef _NO_PROTO
int wait_for_reply()
#else
-int wait_for_reply(u_int wait_time)
+int wait_for_reply(long wait_time)
#endif
{
int result;
void errno_crash_and_burn( char *message )
#endif /* _NO_PROTO */
{
- if( verbose_flag )
- fprintf( stderr, "%s: %s : %s\n", prog, message, strerror( errno ) );
-
+ fprintf( stderr, "%s: %s : %s\n", prog, message, strerror( errno ) );
exit( 4 );
-
} /* errno_crash_and_burn() */
#ifdef _NO_PROTO
int recvfrom_wto( s, buf, len, saddr, timo )
-int s; char *buf; int len; FPING_SOCKADDR *saddr; int timo;
+int s; char *buf; int len; FPING_SOCKADDR *saddr; long timo;
#else
-int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo )
+int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, long timo )
#endif /* _NO_PROTO */
{
unsigned int slen;