[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r14377: forward-port r14375 and try to make it less likely to happen (tor/trunk/src/or)



Author: arma
Date: 2008-04-15 20:10:39 -0400 (Tue, 15 Apr 2008)
New Revision: 14377

Modified:
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/or.h
   tor/trunk/src/or/rephist.c
Log:
forward-port r14375 and try to make it less likely to happen again


Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2008-04-16 00:08:20 UTC (rev 14376)
+++ tor/trunk/src/or/connection_edge.c	2008-04-16 00:10:39 UTC (rev 14377)
@@ -1529,7 +1529,7 @@
 
       if (!conn->use_begindir) {
         /* help predict this next time */
-        rep_hist_note_used_port(socks->port, now);
+        rep_hist_note_used_port(now, socks->port);
       }
     } else if (socks->command == SOCKS_COMMAND_RESOLVE_PTR) {
       rep_hist_note_used_resolve(now); /* help predict this next time */

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2008-04-16 00:08:20 UTC (rev 14376)
+++ tor/trunk/src/or/or.h	2008-04-16 00:10:39 UTC (rev 14377)
@@ -3595,7 +3595,7 @@
 long rep_hist_get_weighted_time_known(const char *id, time_t when);
 int rep_hist_have_measured_enough_stability(void);
 
-void rep_hist_note_used_port(uint16_t port, time_t now);
+void rep_hist_note_used_port(time_t now, uint16_t port);
 smartlist_t *rep_hist_get_predicted_ports(time_t now);
 void rep_hist_note_used_resolve(time_t now);
 void rep_hist_note_used_internal(time_t now, int need_uptime,

Modified: tor/trunk/src/or/rephist.c
===================================================================
--- tor/trunk/src/or/rephist.c	2008-04-16 00:08:20 UTC (rev 14376)
+++ tor/trunk/src/or/rephist.c	2008-04-16 00:10:39 UTC (rev 14377)
@@ -1380,7 +1380,7 @@
  * some circuits open that will exit to this port.
  */
 static void
-add_predicted_port(uint16_t port, time_t now)
+add_predicted_port(time_t now, uint16_t port)
 {
   /* XXXX we could just use uintptr_t here, I think. */
   uint16_t *tmp_port = tor_malloc(sizeof(uint16_t));
@@ -1401,7 +1401,7 @@
 {
   predicted_ports_list = smartlist_create();
   predicted_ports_times = smartlist_create();
-  add_predicted_port(80, time(NULL)); /* add one to kickstart us */
+  add_predicted_port(time(NULL), 80); /* add one to kickstart us */
 }
 
 /** Free whatever memory is needed for predicting which ports will
@@ -1423,7 +1423,7 @@
  * future and making exit circuits to anticipate that.
  */
 void
-rep_hist_note_used_port(uint16_t port, time_t now)
+rep_hist_note_used_port(time_t now, uint16_t port)
 {
   int i;
   uint16_t *tmp_port;
@@ -1444,7 +1444,7 @@
     }
   }
   /* it's not there yet; we need to add it */
-  add_predicted_port(port, now);
+  add_predicted_port(now, port);
 }
 
 /** For this long after we've seen a request for a given port, assume that
@@ -1491,7 +1491,7 @@
 void
 rep_hist_note_used_resolve(time_t now)
 {
-  rep_hist_note_used_port(80, now);
+  rep_hist_note_used_port(now, 80);
 }
 
 /** The last time at which we needed an internal circ. */