routelen = 4;
else {
log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
+#ifdef TOR_FRAGILE
+ tor_assert(0);
+#endif
return -1;
}
#endif
return r;
}
log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
+#ifdef TOR_FRAGILE
+ tor_assert(0);
+#endif
return NULL;
}
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;
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) {
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) {
if (conn->marked_for_close) {
log(LOG_WARN, "Bug: Double mark-for-close on connection.");
+#ifdef TOR_FRAGILE
+ tor_assert(0);
+#endif
return -1;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
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;
}
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;
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;
}
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;
}
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;
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;
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);
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? */
#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);
}
/* 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);
#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