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

[or-cvs] r7044: save 3-7 bytes per edge connection (tor/trunk/src/or)



Author: arma
Date: 2006-08-14 01:53:57 -0400 (Mon, 14 Aug 2006)
New Revision: 7044

Modified:
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/or.h
Log:
save 3-7 bytes per edge connection


Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2006-08-14 00:28:44 UTC (rev 7043)
+++ tor/trunk/src/or/connection_edge.c	2006-08-14 05:53:57 UTC (rev 7044)
@@ -417,7 +417,8 @@
     circ->timestamp_dirty -= options->MaxCircuitDirtiness;
     /* give our stream another 'cutoff' seconds to try */
     conn->_base.timestamp_lastread += cutoff;
-    conn->num_socks_retries++;
+    if (conn->num_socks_retries < 250) /* avoid overflow */
+      conn->num_socks_retries++;
     /* move it back into 'pending' state, and try to attach. */
     if (connection_ap_detach_retriable(conn, TO_ORIGIN_CIRCUIT(circ))<0) {
       connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-08-14 00:28:44 UTC (rev 7043)
+++ tor/trunk/src/or/or.h	2006-08-14 05:53:57 UTC (rev 7044)
@@ -713,7 +713,7 @@
   /** Number of times we've reassigned this application connection to
    * a new circuit. We keep track because the timeout is longer if we've
    * already retried several times. */
-  int num_socks_retries;
+  uint8_t num_socks_retries;
 
   /** Nickname of planned exit node -- used with .exit support. */
   char *chosen_exit_name;