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

[or-cvs] clean up this TOR_FRAGILE business



Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or

Modified Files:
	circuitbuild.c circuituse.c connection.c connection_edge.c 
	connection_or.c directory.c dns.c main.c or.h 
Log Message:
clean up this TOR_FRAGILE business


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- circuitbuild.c	25 Apr 2005 15:43:37 -0000	1.108
+++ circuitbuild.c	26 Apr 2005 18:52:15 -0000	1.109
@@ -820,9 +820,7 @@
     routelen = 4;
   else {
     log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
-#ifdef TOR_FRAGILE
-    tor_assert(0);
-#endif
+    tor_fragile_assert();
     return -1;
   }
 #endif
@@ -1138,9 +1136,7 @@
       return r;
   }
   log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
-#ifdef TOR_FRAGILE
-  tor_assert(0);
-#endif
+  tor_fragile_assert();
   return NULL;
 }
 

Index: circuituse.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuituse.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- circuituse.c	7 Apr 2005 21:07:19 -0000	1.69
+++ circuituse.c	26 Apr 2005 18:52:15 -0000	1.70
@@ -731,9 +731,7 @@
         default:
           log_fn(LOG_WARN,"Bug: unexpected purpose %d when cannibalizing a general circ.",
                  purpose);
-#ifdef TOR_FRAGILE
-          tor_assert(0);
-#endif
+          tor_fragile_assert();
           return NULL;
       }
       return circ;

Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.363
retrieving revision 1.364
diff -u -d -r1.363 -r1.364
--- connection.c	8 Apr 2005 03:36:39 -0000	1.363
+++ connection.c	26 Apr 2005 18:52:15 -0000	1.364
@@ -270,9 +270,7 @@
   if (CONN_IS_EDGE(conn)) {
     if (!conn->has_sent_end) {
       log_fn(LOG_WARN,"Harmless bug: Edge connection (marked at %s:%d) hasn't sent end yet?", conn->marked_for_close_file, conn->marked_for_close);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
     }
   }
 
@@ -345,9 +343,7 @@
   assert_connection_ok(conn,0);
   if (conn->s < 0) {
     log_fn(LOG_WARN,"Bug: Attempt to close already-closed connection.");
-#ifdef TOR_FRAGILE
-    tor_assert(0);
-#endif
+    tor_fragile_assert();
     return;
   }
   if (conn->outbuf_flushlen) {
@@ -380,9 +376,7 @@
     log(LOG_WARN, "Duplicate call to connection_mark_for_close at %s:%d"
         " (first at %s:%d)", file, line, conn->marked_for_close_file,
         conn->marked_for_close);
-#ifdef TOR_FRAGILE
-    tor_assert(0);
-#endif
+    tor_fragile_assert();
     return;
   }
 
@@ -1572,9 +1566,7 @@
       return connection_control_process_inbuf(conn);
     default:
       log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       return -1;
   }
 }
@@ -1607,9 +1599,7 @@
       return connection_control_finished_flushing(conn);
     default:
       log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       return -1;
   }
 }
@@ -1633,9 +1623,7 @@
       return connection_dir_finished_connecting(conn);
     default:
       log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       return -1;
   }
 }
@@ -1658,9 +1646,7 @@
       return connection_control_reached_eof(conn);
     default:
       log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       return -1;
   }
 }

Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.320
retrieving revision 1.321
diff -u -d -r1.320 -r1.321
--- connection_edge.c	7 Apr 2005 20:25:22 -0000	1.320
+++ connection_edge.c	26 Apr 2005 18:52:15 -0000	1.321
@@ -129,9 +129,7 @@
       return 0;
   }
   log_fn(LOG_WARN,"Bug: Got unexpected state %d. Closing.",conn->state);
-#ifdef TOR_FRAGILE
-  tor_assert(0);
-#endif
+  tor_fragile_assert();
   connection_edge_end(conn, END_STREAM_REASON_INTERNAL, conn->cpath_layer);
   connection_mark_for_close(conn);
   return -1;
@@ -176,9 +174,7 @@
 
   if (conn->has_sent_end) {
     log_fn(LOG_WARN,"Harmless bug: Calling connection_edge_end (reason %d) on an already ended stream?", reason);
-#ifdef TOR_FRAGILE
-    tor_assert(0);
-#endif
+    tor_fragile_assert();
     return -1;
   }
 
@@ -251,9 +247,7 @@
       return 0;
     default:
       log_fn(LOG_WARN,"BUG: called in unexpected state %d.", conn->state);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       return -1;
   }
   return 0;

Index: connection_or.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_or.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- connection_or.c	26 Apr 2005 18:33:33 -0000	1.171
+++ connection_or.c	26 Apr 2005 18:52:15 -0000	1.172
@@ -148,9 +148,7 @@
       break;
     default:
       log_fn(LOG_WARN,"BUG: called in unexpected state %d.", conn->state);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       return -1;
   }
   return 0;

Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.223
retrieving revision 1.224
diff -u -d -r1.223 -r1.224
--- directory.c	7 Apr 2005 21:09:19 -0000	1.223
+++ directory.c	26 Apr 2005 18:52:15 -0000	1.224
@@ -1126,9 +1126,7 @@
       return 0;
     default:
       log_fn(LOG_WARN,"Bug: called in unexpected state %d.", conn->state);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       return -1;
   }
   return 0;

Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -d -r1.147 -r1.148
--- dns.c	6 Apr 2005 20:25:21 -0000	1.147
+++ dns.c	26 Apr 2005 18:52:15 -0000	1.148
@@ -139,15 +139,11 @@
     log(LOG_DEBUG,"Forgetting old cached resolve (expires %lu)", (unsigned long)resolve->expire);
     if (resolve->state == CACHE_STATE_PENDING) {
       log_fn(LOG_WARN,"Bug: Expiring a dns resolve that's still pending. Forgot to cull it?");
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
     }
     if (resolve->pending_connections) {
       log_fn(LOG_WARN, "Closing pending connections on expiring DNS resolve!");
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       while (resolve->pending_connections) {
         pend = resolve->pending_connections;
         resolve->pending_connections = pend->next;
@@ -439,9 +435,7 @@
   if (!resolve->pending_connections) {
     /* XXX this should never trigger, but sometimes it does */
     log_fn(LOG_WARN,"Bug: Address '%s' is pending but has no pending connections!", address);
-#ifdef TOR_FRAGILE
-    tor_assert(0);
-#endif
+    tor_fragile_assert();
     return;
   }
   tor_assert(resolve->pending_connections);
@@ -637,10 +631,8 @@
   tor_assert(conn->type == CONN_TYPE_DNSWORKER);
 
   if (conn->state != DNSWORKER_STATE_BUSY && buf_datalen(conn->inbuf)) {
-    log_fn(LOG_WARN,"Bug: read data (%d bytes) from an idle dns worker.  Please report.", (int)buf_datalen(conn->inbuf));
-#ifdef TOR_FRAGILE
-    tor_assert(0);
-#endif
+    log_fn(LOG_WARN,"Bug: read data (%d bytes) from an idle dns worker (address '%s'.  Please report.", (int)buf_datalen(conn->inbuf), conn->address);
+    tor_fragile_assert();
     return 0;
   }
   if (buf_datalen(conn->inbuf) < 5) /* entire answer available? */

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.488
retrieving revision 1.489
diff -u -d -r1.488 -r1.489
--- main.c	25 Apr 2005 17:24:16 -0000	1.488
+++ main.c	26 Apr 2005 18:52:15 -0000	1.489
@@ -356,9 +356,7 @@
 #ifndef MS_WINDOWS
       log_fn(LOG_WARN,"Bug: unhandled error on read for %s connection (fd %d); removing",
              conn_type_to_string(conn->type), conn->s);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
 #endif
       if (CONN_IS_EDGE(conn))
         connection_edge_end_errno(conn, conn->cpath_layer);
@@ -388,9 +386,7 @@
       /* this connection is broken. remove it. */
       log_fn(LOG_WARN,"Bug: unhandled error on write for %s connection (fd %d); removing",
              conn_type_to_string(conn->type), conn->s);
-#ifdef TOR_FRAGILE
-      tor_assert(0);
-#endif
+      tor_fragile_assert();
       conn->has_sent_end = 1; /* otherwise we cry wolf about duplicate close */
       /* XXX do we need a close-immediate here, so we don't try to flush? */
       connection_mark_for_close(conn);

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.595
retrieving revision 1.596
diff -u -d -r1.595 -r1.596
--- or.h	26 Apr 2005 18:33:33 -0000	1.595
+++ or.h	26 Apr 2005 18:52:16 -0000	1.596
@@ -146,10 +146,6 @@
 #define cell_t tor_cell_t
 #endif
 
-/** Define this if you want Tor to crash when any problem comes up,
- * so you can get a coredump and track things down. */
-#undef TOR_FRAGILE
-
 #define DEFAULT_BANDWIDTH_OP (1024 * 1000)
 #define MAX_NICKNAME_LEN 19
 /* Hex digest plus dollar sign. */