From: Roger Wolff Date: Wed, 7 Apr 1999 00:00:00 +0000 (+0000) Subject: mtr v0.35 X-Git-Tag: v0.35^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efb19614783cab6161dc791b4bf550193236fd51;p=thirdparty%2Fmtr.git mtr v0.35 - Added Craig Milo Rogers pause/resume for GTK patch. - Added Craig Milo Rogers cleanup of "reset". (restart at the beginning) - Net_open used to send a first packet. After that the display-driver got a chance to distort the timing by taking its time to initialize. source: ftp://ftp.bitwizard.nl/mtr/mtr-0.35.tar.gz --- diff --git a/AUTHORS b/AUTHORS index f771b61..ba73271 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,19 +12,20 @@ Thanks especially to those of you who have sent code: (Reverse alphabetical order) - Juha Takala, - David Sward (sward@clark.net), + Juha Takala, + David Sward (sward@clark.net), Andrew Stesin, Aaron Scarisbrick, + Craig Milo Rogers (Rogers@ISI.EDU), Russell Nelson, - Alexander V. Lukyanov, + Alexander V. Lukyanov, Charles Levert, Bertrand Leconte, Anand Kumria, - Adam Kramer (l3zqc@qcunix1.acc.qc.edu), + Adam Kramer (l3zqc@qcunix1.acc.qc.edu), Simon Kirby, Christophe Kalt, - Steve Kann (stevek@spheara.horizonlive.com), + Steve Kann (stevek@spheara.horizonlive.com), Mircea Damian, Brian Casey, diff --git a/NEWS b/NEWS index a357c7a..9a4e637 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ WHAT'S NEW? + v0.35 Added Craig Milo Rogers pause/resume for GTK patch. + Added Craig Milo Rogers cleanup of "reset". (restart at the beginning) + Net_open used to send a first packet. After that the display-driver + got a chance to distort the timing by taking its time to + initialize. + v0.34 Added Matt's nifty "use the icmp unreachables to do the timing" patch. Added Steve Kann's pause/resume patch. diff --git a/configure.in b/configure.in index fe8e208..a7f745d 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.34) +AM_INIT_AUTOMAKE(mtr, 0.35) AC_SUBST(GTK_OBJ) AC_SUBST(CURSES_OBJ) diff --git a/gtk.c b/gtk.c index f7cce58..dff4d62 100644 --- a/gtk.c +++ b/gtk.c @@ -73,6 +73,22 @@ gint Restart_clicked(GtkWidget *Button, gpointer data) { return FALSE; } +gint gtk_ping(gpointer data); + +gint Pause_clicked(GtkWidget *Button, gpointer data) { + static int paused = 0; + + if (paused) { + tag = gtk_timeout_add(DeltaTime*1000, gtk_ping, NULL); + } else { + gtk_timeout_remove (tag); + } + paused = ! paused; + gtk_redraw(); + + return FALSE; +} + gint Host_activate(GtkWidget *Entry, gpointer data) { int addr; @@ -106,6 +122,12 @@ void Toolbar_fill(GtkWidget *Toolbar) { GTK_SIGNAL_FUNC(Restart_clicked), NULL); gtk_widget_show(Button); + Button = gtk_check_button_new_with_label("Pause"); + gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0); + gtk_signal_connect(GTK_OBJECT(Button), "clicked", + GTK_SIGNAL_FUNC(Pause_clicked), NULL); + gtk_widget_show(Button); + Label = gtk_label_new("Hostname"); gtk_box_pack_start(GTK_BOX(Toolbar), Label, FALSE, FALSE, 0); gtk_widget_show(Label); diff --git a/net.c b/net.c index 75c0c0d..aebda41 100644 --- a/net.c +++ b/net.c @@ -96,6 +96,13 @@ struct sequence { struct timeval time; }; + +/* Configuration parameter: How many queries to unknown hosts do we + send? (This limits the amount of traffic generated if a host is not + reachable) */ +#define MAX_UNKNOWN_HOSTS 5 + + static struct nethost host[MaxHost]; static struct sequence sequence[MaxSequence]; static struct timeval reset = { 0, 0 }; @@ -103,7 +110,11 @@ static struct timeval reset = { 0, 0 }; int sendsock; int recvsock; struct sockaddr_in remoteaddress; +static int batch_at = 0; + +/* This doesn't work for odd sz. I don't know enough about this to say + that this is wrong. It doesn't seem to cripple mtr though. -- REW */ int checksum(void *data, int sz) { unsigned short *ch; unsigned int sum; @@ -332,28 +343,27 @@ void net_end_transit() { int net_send_batch() { - static int at; int n_unknown, i; - net_send_query(at); + net_send_query(batch_at); n_unknown = 0; - for (i=0;i 5)) { - DeltaTime = WaitTime / (float) (at+1); - at = 0; + if ((host[batch_at].addr == remoteaddress.sin_addr.s_addr) || + (n_unknown > MAX_UNKNOWN_HOSTS)) { + DeltaTime = WaitTime / (float) (batch_at+1); + batch_at = 0; return 1; } - at++; + batch_at++; return 0; } @@ -388,8 +398,6 @@ int net_open(int addr) { remoteaddress.sin_family = AF_INET; remoteaddress.sin_addr.s_addr = addr; - net_send_batch(); - return 0; } @@ -411,6 +419,8 @@ void net_reset() { int at; int i; + batch_at = 0; + for(at = 0; at < MaxHost; at++) { host[at].xmit = 0; host[at].transit = 0;