[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] stop double-freeing an exit connection when we"re out of dn...
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] stop double-freeing an exit connection when we"re out of dn...
- From: arma@xxxxxxxx (Roger Dingledine)
- Date: Thu, 3 Feb 2005 20:46:56 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Thu, 03 Feb 2005 20:47:14 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/0091/tor/src/or
Modified Files:
Tag: tor-0_0_9-patches
connection_edge.c dns.c
Log Message:
stop double-freeing an exit connection when we're out of dns workers.
Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.264.2.3
retrieving revision 1.264.2.4
diff -u -d -r1.264.2.3 -r1.264.2.4
--- connection_edge.c 3 Feb 2005 23:41:18 -0000 1.264.2.3
+++ connection_edge.c 4 Feb 2005 01:46:54 -0000 1.264.2.4
@@ -840,10 +840,7 @@
connection_exit_connect(n_stream);
return 0;
case -1: /* resolve failed */
- log_fn(LOG_INFO,"Resolve failed (%s).", n_stream->address);
- if (!n_stream->marked_for_close)
- connection_edge_end(n_stream, END_STREAM_REASON_RESOLVEFAILED, n_stream->cpath_layer);
- connection_free(n_stream);
+ /* n_stream got freed. don't touch it. */
break;
case 0: /* resolve added to pending list */
/* add it into the linked list of resolving_streams on this circuit */
@@ -888,8 +885,7 @@
switch (dns_resolve(dummy_conn)) {
case 1: /* The result was cached; a resolved cell was sent. */
case -1:
- circuit_detach_stream(circuit_get_by_conn(dummy_conn), dummy_conn);
- connection_free(dummy_conn);
+ /* dummy_conn got freed, don't touch it */
return 0;
case 0: /* resolve added to pending list */
assert_circuit_ok(circ);
Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.126.2.6
retrieving revision 1.126.2.7
diff -u -d -r1.126.2.6 -r1.126.2.7
--- dns.c 28 Jan 2005 06:07:54 -0000 1.126.2.6
+++ dns.c 4 Feb 2005 01:46:54 -0000 1.126.2.7
@@ -188,7 +188,7 @@
/** See if we have a cache entry for <b>exitconn</b>-\>address. if so,
* if resolve valid, put it into <b>exitconn</b>-\>addr and return 1.
- * If resolve failed, return -1.
+ * If resolve failed, unlink exitconn if needed, free it, and return -1.
*
* Else, if seen before and pending, add conn to the pending list,
* and return 0.
@@ -201,6 +201,7 @@
struct cached_resolve search;
struct pending_connection_t *pending_connection;
struct in_addr in;
+ circuit_t *circ;
uint32_t now = time(NULL);
assert_connection_ok(exitconn, 0);
tor_assert(exitconn->s == -1);
@@ -244,6 +245,10 @@
exitconn->s, exitconn->address);
if (exitconn->purpose == EXIT_PURPOSE_RESOLVE)
send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
+ circ = circuit_get_by_conn(exitconn);
+ if (circ)
+ circuit_detach_stream(circ, exitconn);
+ connection_free(exitconn);
return -1;
}
tor_assert(0);
@@ -282,7 +287,7 @@
log_fn(LOG_WARN,"no idle dns workers. Failing.");
if (exitconn->purpose == EXIT_PURPOSE_RESOLVE)
send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR_TRANSIENT);
- dns_cancel_pending_resolve(exitconn->address); /* also marks it */
+ dns_cancel_pending_resolve(exitconn->address); /* also *frees* it */
return -1;
}