]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
mtr v0.35 v0.35
authorRoger Wolff <r.e.wolff@bitwizard.nl>
Wed, 7 Apr 1999 00:00:00 +0000 (00:00 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 3 Feb 2013 20:45:37 +0000 (20:45 +0000)
 - 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

AUTHORS
NEWS
configure.in
gtk.c
net.c

diff --git a/AUTHORS b/AUTHORS
index f771b619d613261b9d239df4534040a663bb0941..ba732715b7210659045c183b998f40656d0ffb0f 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
   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 a357c7ab3fb74f665aabb76d121464a9afdd3c0e..9a4e63750b0587f5954c3fe32b8af7c6fce2ba8b 100644 (file)
--- 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. 
 
index fe8e20833dc8536bca9376e87b49e9920a7f43b6..a7f745d80a04185ebd54a4c8bed8db318d516c90 100644 (file)
@@ -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 f7cce58267c0943d4cf9da09186cff147a982d61..dff4d6213200fdff0db9347de1b6578375d3e2a5 100644 (file)
--- 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 75c0c0d2cf950e964d6fb166249d6aa377b9bc31..aebda4112a2e56de42485060a0e7b9c57bb125b2 100644 (file)
--- 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<at;i++) {
+  for (i=0;i<batch_at;i++) {
     if (host[i].addr == 0)
       n_unknown++;
     if (host[i].addr == remoteaddress.sin_addr.s_addr)
       n_unknown = 100; /* Make sure we drop into "we should restart" */
   }
 
-  if ((host[at].addr == remoteaddress.sin_addr.s_addr) ||
-      (n_unknown > 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;