[or-cvs] More cleanups noticed by weasel; also, remove macros that n...

Nick Mathewson nickm at seul.org
Sun Mar 12 23:31:19 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv3641/src/or

Modified Files:
	buffers.c config.c connection.c connection_or.c cpuworker.c 
	main.c or.h rendcommon.c rendservice.c routerlist.c 
Log Message:
More cleanups noticed by weasel; also, remove macros that nobody uses.

Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/buffers.c,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -p -d -r1.186 -r1.187
--- buffers.c	5 Mar 2006 09:50:25 -0000	1.186
+++ buffers.c	12 Mar 2006 23:31:16 -0000	1.187
@@ -69,7 +69,6 @@ uint64_t buf_total_alloc = 0;
 /** Size, in bytes, for minimum 'shrink' size for buffers.  Buffers may start
  * out smaller than this, but they will never autoshrink to less
  * than this size. */
-#define MIN_GREEDY_SHRINK_SIZE (16*1024)
 #define MIN_LAZY_SHRINK_SIZE (4*1024)
 
 static INLINE void peek_from_buf(char *string, size_t string_len, buf_t *buf);
@@ -1156,8 +1155,6 @@ fetch_from_buf_socks(buf_t *buf, socks_r
   }
 }
 
-#define CONTROL_CMD_FRAGMENTHEADER 0x0010
-#define CONTROL_CMD_FRAGMENT       0x0011
 /** If there is a complete version 0 control message waiting on buf, then store
  * its contents into *<b>type_out</b>, store its body's length into
  * *<b>len_out</b>, allocate and store a string for its body into

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.526
retrieving revision 1.527
diff -u -p -d -r1.526 -r1.527
--- config.c	12 Mar 2006 22:48:17 -0000	1.526
+++ config.c	12 Mar 2006 23:31:16 -0000	1.527
@@ -336,9 +336,6 @@ typedef struct {
                *(uint32_t*)STRUCT_VAR_P(cfg,fmt->magic_offset));        \
   } while (0)
 
-/** Largest allowed config line */
-#define CONFIG_LINE_T_MAXLEN 4096
-
 static void config_line_append(config_line_t **lst,
                                const char *key, const char *val);
 static void option_clear(config_format_t *fmt, or_options_t *options,
@@ -4140,6 +4137,9 @@ config_getinfo_helper(const char *questi
   return 0;
 }
 
+#include "../common/ht.h"
+#include "../common/test.h"
+
 /** Dump the version of every file to the log. */
 static void
 print_cvs_version(void)
@@ -4184,6 +4184,8 @@ print_cvs_version(void)
   puts(COMPAT_H_ID);
   puts(CONTAINER_H_ID);
   puts(CRYPTO_H_ID);
+  puts(HT_H_ID);
+  puts(TEST_H_ID);
   puts(LOG_H_ID);
   puts(TORGZIP_H_ID);
   puts(TORINT_H_ID);

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.445
retrieving revision 1.446
diff -u -p -d -r1.445 -r1.446
--- connection.c	8 Mar 2006 22:29:07 -0000	1.445
+++ connection.c	12 Mar 2006 23:31:16 -0000	1.446
@@ -2113,6 +2113,8 @@ assert_connection_ok(connection_t *conn,
     case CONN_TYPE_EXIT:
       tor_assert(conn->state >= _EXIT_CONN_STATE_MIN);
       tor_assert(conn->state <= _EXIT_CONN_STATE_MAX);
+      tor_assert(conn->purpose >= _EXIT_PURPOSE_MIN);
+      tor_assert(conn->purpose <= _EXIT_PURPOSE_MAX);
       break;
     case CONN_TYPE_AP:
       tor_assert(conn->state >= _AP_CONN_STATE_MIN);
@@ -2126,8 +2128,8 @@ assert_connection_ok(connection_t *conn,
       tor_assert(conn->purpose <= _DIR_PURPOSE_MAX);
       break;
     case CONN_TYPE_DNSWORKER:
-      tor_assert(conn->state == DNSWORKER_STATE_IDLE ||
-                 conn->state == DNSWORKER_STATE_BUSY);
+      tor_assert(conn->state >= _DNSWORKER_STATE_MIN);
+      tor_assert(conn->state <= _DNSWORKER_STATE_MAX);
       break;
     case CONN_TYPE_CPUWORKER:
       tor_assert(conn->state >= _CPUWORKER_STATE_MIN);

Index: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_or.c,v
retrieving revision 1.214
retrieving revision 1.215
diff -u -p -d -r1.214 -r1.215
--- connection_or.c	5 Mar 2006 09:50:25 -0000	1.214
+++ connection_or.c	12 Mar 2006 23:31:16 -0000	1.215
@@ -16,6 +16,7 @@ const char connection_or_c_id[] =
 
 /** How much clock skew do we tolerate when checking certificates for
  * known routers? (sec) */
+
 #define TIGHT_CERT_ALLOW_SKEW (90*60)
 
 static int connection_tls_finish_handshake(connection_t *conn);

Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/cpuworker.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -p -d -r1.100 -r1.101
--- cpuworker.c	12 Mar 2006 22:48:17 -0000	1.100
+++ cpuworker.c	12 Mar 2006 23:31:16 -0000	1.101
@@ -23,8 +23,6 @@ const char cpuworker_c_id[] =
 
 /** The tag specifies which circuit this onionskin was from. */
 #define TAG_LEN 8
-/** How many bytes are sent from tor to the cpuworker? */
-#define LEN_ONION_QUESTION (1+TAG_LEN+ONIONSKIN_CHALLENGE_LEN)
 /** How many bytes are sent from the cpuworker back to tor? */
 #define LEN_ONION_RESPONSE \
   (1+TAG_LEN+ONIONSKIN_REPLY_LEN+CPATH_KEY_MATERIAL_LEN)

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.631
retrieving revision 1.632
diff -u -p -d -r1.631 -r1.632
--- main.c	12 Mar 2006 22:48:17 -0000	1.631
+++ main.c	12 Mar 2006 23:31:16 -0000	1.632
@@ -96,7 +96,7 @@ static char* nt_strerror(uint32_t errnum
  * that would require an upload? */
 #define CHECK_DESCRIPTOR_INTERVAL (60)
 /** How often do we (as a router) check whether our IP address has changed? */
-#define CHECK_IPADDRESS_INTERVAL (15*60) /* 15 minutes */
+#define CHECK_IPADDRESS_INTERVAL (15*60)
 /** How often do we check buffers for empty space that can be deallocated? */
 #define BUF_SHRINK_INTERVAL (60)
 /** How often do we check for router descriptors that we should download? */

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.804
retrieving revision 1.805
diff -u -p -d -r1.804 -r1.805
--- or.h	12 Mar 2006 22:48:18 -0000	1.804
+++ or.h	12 Mar 2006 23:31:16 -0000	1.805
@@ -534,10 +534,6 @@ typedef enum {
 /** How long to test reachability before complaining to the user. */
 #define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60)
 
-/* people behind fascist firewalls use only these ports */
-#define REQUIRED_FIREWALL_DIRPORT 80
-#define REQUIRED_FIREWALL_ORPORT 443
-
 /* legal characters in a nickname */
 #define LEGAL_NICKNAME_CHARACTERS \
   "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
@@ -1689,10 +1685,6 @@ connection_t *connection_get_by_type_sta
                                                      const char *rendquery);
 
 #define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR)
-#define connection_has_pending_tls_data(conn) \
-  ((conn)->type == CONN_TYPE_OR && \
-   (conn)->state == OR_CONN_STATE_OPEN && \
-   tor_tls_get_pending_bytes((conn)->tls))
 int connection_is_listener(connection_t *conn);
 int connection_state_is_open(connection_t *conn);
 int connection_state_is_connecting(connection_t *conn);

Index: rendcommon.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendcommon.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -p -d -r1.67 -r1.68
--- rendcommon.c	12 Mar 2006 22:48:18 -0000	1.67
+++ rendcommon.c	12 Mar 2006 23:31:16 -0000	1.68
@@ -233,7 +233,7 @@ rend_get_service_id(crypto_pk_env_t *pk,
 
 /** How old do we let hidden service descriptors get discarding them as too
  * old? */
-#define REND_CACHE_MAX_AGE (48*60*60)
+#define REND_CACHE_MAX_AGE (2*24*60*60)
 /** How wrong to we assume our clock may be when checking whether hidden
  * services are too old or too new? */
 #define REND_CACHE_MAX_SKEW (24*60*60)

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendservice.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -p -d -r1.157 -r1.158
--- rendservice.c	6 Mar 2006 00:25:39 -0000	1.157
+++ rendservice.c	12 Mar 2006 23:31:16 -0000	1.158
@@ -27,7 +27,7 @@ typedef struct rend_service_port_config_
 #define NUM_INTRO_POINTS 3
 
 /** If we can't build our intro circuits, don't retry for this long. */
-#define INTRO_CIRC_RETRY_PERIOD 60*5
+#define INTRO_CIRC_RETRY_PERIOD (60*5)
 /** Don't try to build more than this many circuits before giving up
  * for a while.*/
 #define MAX_INTRO_CIRCS_PER_PERIOD 10
@@ -927,10 +927,6 @@ upload_service_descriptor(rend_service_t
   service->desc_is_dirty = 0;
 }
 
-/* XXXX Make this longer once directories remember service descriptors across
- * restarts.*/
-#define MAX_SERVICE_PUBLICATION_INTERVAL (15*60)
-
 /** For every service, check how many intro points it currently has, and:
  *  - Pick new intro points as necessary.
  *  - Launch circuits to any new intro points.

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.453
retrieving revision 1.454
diff -u -p -d -r1.453 -r1.454
--- routerlist.c	12 Mar 2006 22:48:18 -0000	1.453
+++ routerlist.c	12 Mar 2006 23:31:16 -0000	1.454
@@ -3437,10 +3437,6 @@ update_router_descriptor_client_download
   /** When directory clients have only a few servers to request, they batch
    * them until they have more, or until this amount of time has passed. */
 #define MAX_CLIENT_INTERVAL_WITHOUT_REQUEST (10*60)
-  /** When directory caches and authorities have only a few servers to
-   * request, they batch them until they have more, or until this amount of
-   * time has passed. */
-#define MAX_SERVER_INTERVAL_WITHOUT_REQUEST (60)
   smartlist_t *downloadable = NULL;
   int should_delay, n_downloadable;
   or_options_t *options = get_options();



More information about the tor-commits mailing list