[or-cvs] Add a bunch more warnings to out warning suite; resolve the...

Nick Mathewson nickm at seul.org
Thu Sep 29 22:59:20 UTC 2005


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

Modified Files:
	circuitbuild.c connection.c dirserv.c or.h 
Log Message:
Add a bunch more warnings to out warning suite; resolve them; pack structs a little better.

Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- circuitbuild.c	14 Sep 2005 23:42:06 -0000	1.144
+++ circuitbuild.c	29 Sep 2005 22:59:17 -0000	1.145
@@ -979,6 +979,8 @@
   uint16_t *port;
   smartlist_t *sl = circuit_get_unhandled_ports(now);
   smartlist_t *LongLivedServices = get_options()->LongLivedPorts;
+  tor_assert(need_uptime);
+  tor_assert(need_capacity);
   enough = (smartlist_len(sl) == 0);
   for (i = 0; i < smartlist_len(sl); ++i) {
     port = smartlist_get(sl, i);
@@ -1380,6 +1382,8 @@
   routerinfo_t *r, *choice;
   crypt_path_t *cpath;
   smartlist_t *excluded;
+  tor_assert(_CIRCUIT_PURPOSE_MIN <= purpose &&
+             purpose <= _CIRCUIT_PURPOSE_MAX);
 
   log_fn(LOG_DEBUG, "Contemplating intermediate hop: random choice.");
   excluded = smartlist_create();

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.399
retrieving revision 1.400
diff -u -d -r1.399 -r1.400
--- connection.c	14 Sep 2005 02:36:29 -0000	1.399
+++ connection.c	29 Sep 2005 22:59:17 -0000	1.400
@@ -2000,8 +2000,10 @@
     tor_assert(!conn->cpath_layer);
     tor_assert(!conn->package_window);
     tor_assert(!conn->deliver_window);
+#if 0
     tor_assert(!conn->done_sending);
     tor_assert(!conn->done_receiving);
+#endif
   } else {
     /* XXX unchecked: package window, deliver window. */
   }

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- dirserv.c	23 Sep 2005 17:11:20 -0000	1.241
+++ dirserv.c	29 Sep 2005 22:59:17 -0000	1.242
@@ -303,7 +303,7 @@
 
 /** Clear the current fingerprint list. */
 void
-dirserv_free_fingerprint_list()
+dirserv_free_fingerprint_list(void)
 {
   int i;
   fingerprint_entry_t *ent;
@@ -555,7 +555,7 @@
  * generated one.
  */
 void
-directory_set_dirty()
+directory_set_dirty(void)
 {
   time_t now = time(NULL);
 

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.696
retrieving revision 1.697
diff -u -d -r1.696 -r1.697
--- or.h	24 Sep 2005 21:56:04 -0000	1.696
+++ or.h	29 Sep 2005 22:59:17 -0000	1.697
@@ -591,24 +591,29 @@
   uint8_t type; /**< What kind of connection is this? */
   uint8_t state; /**< Current state of this connection. */
   uint8_t purpose; /**< Only used for DIR types currently. */
-  uint8_t wants_to_read; /**< Boolean: should we start reading again once
-                          * the bandwidth throttler allows it?
-                          */
-  uint8_t wants_to_write; /**< Boolean: should we start writing again once
-                           * the bandwidth throttler allows reads?
-                           */
+  unsigned wants_to_read:1; /**< Boolean: should we start reading again once
+                            * the bandwidth throttler allows it?
+                            */
+  unsigned wants_to_write:1; /**< Boolean: should we start writing again once
+                             * the bandwidth throttler allows reads?
+                             */
+  unsigned marked_for_close:1; /**< Boolean: should we close this conn on the
+                               * next iteration of the main loop?
+                               */
+  unsigned hold_open_until_flushed:1; /**< Despite this connection's being
+                                      * marked for close, do we flush it
+                                      * before closing it?
+                                      */
+  unsigned has_sent_end:1; /**< For debugging; only used on edge connections.
+                         * Set once we've set the stream end,
+                         * and check in circuit_about_to_close_connection(). */
+
   int s; /**< Our socket; -1 if this connection is closed. */
   int poll_index; /* XXXX rename. */
   struct event *read_event; /**< libevent event structure. */
   struct event *write_event; /**< libevent event structure. */
-  int marked_for_close; /**< Boolean: should we close this conn on the next
-                         * iteration of the main loop?
-                         */
   const char *marked_for_close_file; /**< For debugging: in which file were
                                       * we marked for close? */
-  int hold_open_until_flushed; /**< Despite this connection's being marked
-                                * for close, do we flush it before closing it?
-                                */
 
   buf_t *inbuf; /**< Buffer holding data read over this connection. */
   int inbuf_reached_eof; /**< Boolean: did read() return 0 on this conn? */
@@ -668,10 +673,10 @@
   int deliver_window; /**< How many more relay cells can end at me? (Edge
                        * only.) */
 
+#if 0
   int done_sending; /**< For half-open connections; not used currently. */
   int done_receiving; /**< For half-open connections; not used currently. */
-  char has_sent_end; /**< For debugging: set once we've set the stream end,
-                        and check in circuit_about_to_close_connection(). */
+#endif
   struct circuit_t *on_circuit; /**< The circuit (if any) that this edge
                                  * connection is using. */
 
@@ -805,9 +810,9 @@
 /** DOCDOC */
 typedef struct local_routerstatus_t {
   routerstatus_t status;
+  time_t next_attempt_at; /**< When should we try this descriptor again? */
   uint8_t n_download_failures; /**< Number of failures trying to download the
                                 * most recent descriptor. */
-  time_t next_attempt_at; /**< When should we try this descriptor again? */
   unsigned int should_download:1; /**< DOCDOC */
 } local_routerstatus_t;
 
@@ -1101,9 +1106,9 @@
   uint16_t port_min;
   uint16_t port_max;
 
-  int is_redirect;
   uint32_t addr_dest;
   uint16_t port_dest;
+  unsigned is_redirect:1;
 } exit_redirect_t;
 
 typedef struct config_line_t {



More information about the tor-commits mailing list