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

[or-cvs] define TOR_FRAGILE if you want tor to give you a core when



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:
define TOR_FRAGILE if you want tor to give you a core when
something goes wrong. this should only be used by people actively
tracking bugs.


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- circuitbuild.c	19 Jan 2005 17:59:37 -0000	1.80
+++ circuitbuild.c	1 Feb 2005 00:37:16 -0000	1.81
@@ -764,6 +764,9 @@
     routelen = 4;
   else {
     log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
+#ifdef TOR_FRAGILE
+    tor_assert(0);
+#endif
     return -1;
   }
 #endif
@@ -1078,6 +1081,9 @@
       return r;
   }
   log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
+#ifdef TOR_FRAGILE
+  tor_assert(0);
+#endif
   return NULL;
 }
 

Index: circuituse.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuituse.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- circuituse.c	20 Jan 2005 07:02:24 -0000	1.47
+++ circuituse.c	1 Feb 2005 00:37:16 -0000	1.48
@@ -699,6 +699,9 @@
         default:
           log_fn(LOG_WARN,"Bug: unexpected purpose %d when cannibalizing a general circ.",
                  purpose);
+#ifdef TOR_FRAGILE
+          tor_assert(0);
+#endif
           return NULL;
       }
       return circ;

Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.320
retrieving revision 1.321
diff -u -d -r1.320 -r1.321
--- connection.c	31 Jan 2005 01:27:49 -0000	1.320
+++ connection.c	1 Feb 2005 00:37:16 -0000	1.321
@@ -220,8 +220,12 @@
   assert(conn->marked_for_close);
 
   if (conn->type == CONN_TYPE_AP || conn->type == CONN_TYPE_EXIT) {
-    if (!conn->has_sent_end)
+    if (!conn->has_sent_end) {
       log_fn(LOG_WARN,"Bug: Edge connection hasn't sent end yet?");
+#ifdef TOR_FRAGILE
+      tor_assert(0);
+#endif
+    }
   }
 
   switch (conn->type) {
@@ -295,6 +299,9 @@
   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
     return;
   }
   if (conn->outbuf_flushlen) {
@@ -319,6 +326,9 @@
 
   if (conn->marked_for_close) {
     log(LOG_WARN, "Bug: Double mark-for-close on connection.");
+#ifdef TOR_FRAGILE
+    tor_assert(0);
+#endif
     return -1;
   }
 
@@ -1371,6 +1381,9 @@
       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
       return -1;
   }
 }
@@ -1403,6 +1416,9 @@
       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
       return -1;
   }
 }
@@ -1426,6 +1442,9 @@
       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
       return -1;
   }
 }
@@ -1448,6 +1467,9 @@
       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
       return -1;
   }
 }

Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.270
retrieving revision 1.271
diff -u -d -r1.270 -r1.271
--- connection_edge.c	31 Jan 2005 08:12:30 -0000	1.270
+++ connection_edge.c	1 Feb 2005 00:37:16 -0000	1.271
@@ -93,6 +93,9 @@
       return 0;
   }
   log_fn(LOG_WARN,"Bug: Got unexpected state %d. Closing.",conn->state);
+#ifdef TOR_FRAGILE
+  tor_assert(0);
+#endif
   connection_edge_end(conn, END_STREAM_REASON_MISC, conn->cpath_layer);
   connection_mark_for_close(conn);
   return -1;
@@ -131,6 +134,9 @@
 
   if (conn->has_sent_end) {
     log_fn(LOG_WARN,"Bug: Calling connection_edge_end on an already ended stream?");
+#ifdef TOR_FRAGILE
+    tor_assert(0);
+#endif
     return -1;
   }
 
@@ -183,6 +189,9 @@
       return 0;
     default:
       log_fn(LOG_WARN,"BUG: called in unexpected state %d.", conn->state);
+#ifdef TOR_FRAGILE
+      tor_assert(0);
+#endif
       return -1;
   }
   return 0;

Index: connection_or.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_or.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- connection_or.c	30 Jan 2005 23:52:47 -0000	1.156
+++ connection_or.c	1 Feb 2005 00:37:16 -0000	1.157
@@ -78,6 +78,9 @@
 
   if (conn->state != OR_CONN_STATE_OPEN) {
     log_fn(LOG_WARN,"BUG: called in unexpected state %d",conn->state);
+#ifdef TOR_FRAGILE
+    tor_assert(0);
+#endif
     return -1;
   }
 
@@ -210,7 +213,7 @@
 
   if (server_mode(get_options()) && (me=router_get_my_routerinfo()) &&
       !memcmp(me->identity_digest, id_digest,DIGEST_LEN)) {
-    log_fn(LOG_WARN,"Bug: Request to connect to myself! Failing.");
+    log_fn(LOG_WARN,"Bug: Client asked me to connect to myself! Refusing.");
     return NULL;
   }
 

Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -d -r1.207 -r1.208
--- directory.c	30 Jan 2005 06:08:42 -0000	1.207
+++ directory.c	1 Feb 2005 00:37:16 -0000	1.208
@@ -1080,6 +1080,9 @@
       return 0;
     default:
       log_fn(LOG_WARN,"Bug: called in unexpected state %d.", conn->state);
+#ifdef TOR_FRAGILE
+      tor_assert(0);
+#endif
       return -1;
   }
   return 0;

Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- dns.c	28 Jan 2005 08:53:47 -0000	1.132
+++ dns.c	1 Feb 2005 00:37:16 -0000	1.133
@@ -118,9 +118,15 @@
     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
     }
     if (resolve->pending_connections) {
       log_fn(LOG_WARN, "Closing pending connections on expiring DNS resolve!");
+#ifdef TOR_FRAGILE
+      tor_assert(0);
+#endif
       while (resolve->pending_connections) {
         pend = resolve->pending_connections;
         resolve->pending_connections = pend->next;
@@ -401,6 +407,9 @@
   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
     return;
   }
   tor_assert(resolve->pending_connections);
@@ -596,6 +605,9 @@
 
   if (conn->state != DNSWORKER_STATE_BUSY && buf_datalen(conn->inbuf)) {
     log_fn(LOG_WARN,"Bug: read data from an idle dns worker.  Please report.");
+#ifdef TOR_FRAGILE
+    tor_assert(0);
+#endif
     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.435
retrieving revision 1.436
diff -u -d -r1.435 -r1.436
--- main.c	31 Jan 2005 00:33:32 -0000	1.435
+++ main.c	1 Feb 2005 00:37:16 -0000	1.436
@@ -339,6 +339,9 @@
 #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
 #endif
       connection_mark_for_close(conn);
     }
@@ -366,6 +369,9 @@
       /* 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
       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.531
retrieving revision 1.532
diff -u -d -r1.531 -r1.532
--- or.h	31 Jan 2005 00:33:32 -0000	1.531
+++ or.h	1 Feb 2005 00:37:16 -0000	1.532
@@ -128,6 +128,10 @@
 #include "../common/util.h"
 #include "../common/torgzip.h"
 
+/** 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
+
 /** Upper bound on maximum simultaneous connections; can be lowered by
  * config file. */
 #define MAXCONNECTIONS 15000