mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 13:53:31 +01:00
r9855@Kushana: nickm | 2006-12-04 00:55:09 -0500
Merge circuit_about_to_close_connection and connection_about_to_close_connection. svn:r9021
This commit is contained in:
parent
f90cd5bfc0
commit
a91c12f2e7
@ -3,6 +3,11 @@ Changes in version 0.1.2.5-xxxx - 200?-??-??
|
|||||||
- Fix a bug when a PF socket is first used. (Patch from Fabian
|
- Fix a bug when a PF socket is first used. (Patch from Fabian
|
||||||
Keil)
|
Keil)
|
||||||
|
|
||||||
|
o Controller bugfixes:
|
||||||
|
- Report the circuit number correctly in STREAM CLOSED events. (Bug
|
||||||
|
reported by Mike Perry)
|
||||||
|
|
||||||
|
|
||||||
Changes in version 0.1.2.4-alpha - 2006-12-03
|
Changes in version 0.1.2.4-alpha - 2006-12-03
|
||||||
o Major features:
|
o Major features:
|
||||||
- Add support for using natd; this allows FreeBSDs earlier than
|
- Add support for using natd; this allows FreeBSDs earlier than
|
||||||
|
@ -518,50 +518,6 @@ circuit_detach_stream(circuit_t *circ, edge_connection_t *conn)
|
|||||||
tor_assert(0); /* should never get here */
|
tor_assert(0); /* should never get here */
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Notify the global circuit list that <b>conn</b> is about to be
|
|
||||||
* removed and then freed.
|
|
||||||
*
|
|
||||||
* If it's an OR conn, then mark-for-close all the circuits that use
|
|
||||||
* that conn.
|
|
||||||
*
|
|
||||||
* If it's an edge conn, then detach it from its circ, so we don't
|
|
||||||
* try to reference it later.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
circuit_about_to_close_connection(connection_t *conn)
|
|
||||||
{
|
|
||||||
/* currently, we assume it's too late to flush conn's buf here.
|
|
||||||
* down the road, maybe we'll consider that eof doesn't mean can't-write
|
|
||||||
*/
|
|
||||||
switch (conn->type) {
|
|
||||||
case CONN_TYPE_OR: {
|
|
||||||
if (!connection_state_is_open(conn)) {
|
|
||||||
/* Inform any pending (not attached) circs that they should
|
|
||||||
* give up. */
|
|
||||||
circuit_n_conn_done(TO_OR_CONN(conn), 0);
|
|
||||||
}
|
|
||||||
/* Now close all the attached circuits on it. */
|
|
||||||
circuit_unlink_all_from_or_conn(TO_OR_CONN(conn),
|
|
||||||
END_CIRC_REASON_OR_CONN_CLOSED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case CONN_TYPE_AP:
|
|
||||||
case CONN_TYPE_EXIT: {
|
|
||||||
circuit_t *circ;
|
|
||||||
/* It's an edge conn. Need to remove it from the linked list of
|
|
||||||
* conn's for this circuit. Confirm that 'end' relay command has
|
|
||||||
* been sent. But don't kill the circuit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
circ = circuit_get_by_edge_conn(TO_EDGE_CONN(conn));
|
|
||||||
if (!circ)
|
|
||||||
return;
|
|
||||||
|
|
||||||
circuit_detach_stream(circ, TO_EDGE_CONN(conn));
|
|
||||||
}
|
|
||||||
} /* end switch */
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Find each circuit that has been unused for too long, or dirty
|
/** Find each circuit that has been unused for too long, or dirty
|
||||||
* for too long and has no streax=ms on it: mark it for close.
|
* for too long and has no streax=ms on it: mark it for close.
|
||||||
*/
|
*/
|
||||||
|
@ -393,6 +393,7 @@ connection_free_all(void)
|
|||||||
* - Exit conns need to call connection_dns_remove() if necessary.
|
* - Exit conns need to call connection_dns_remove() if necessary.
|
||||||
* - AP and Exit conns need to send an end cell if they can.
|
* - AP and Exit conns need to send an end cell if they can.
|
||||||
* - DNS conns need to fail any resolves that are pending on them.
|
* - DNS conns need to fail any resolves that are pending on them.
|
||||||
|
* - OR and edge connections need to be unlinked from circuits.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
connection_about_to_close_connection(connection_t *conn)
|
connection_about_to_close_connection(connection_t *conn)
|
||||||
@ -436,6 +437,9 @@ connection_about_to_close_connection(connection_t *conn)
|
|||||||
router_set_status(or_conn->identity_digest, 0);
|
router_set_status(or_conn->identity_digest, 0);
|
||||||
control_event_or_conn_status(or_conn, OR_CONN_EVENT_FAILED);
|
control_event_or_conn_status(or_conn, OR_CONN_EVENT_FAILED);
|
||||||
}
|
}
|
||||||
|
/* Inform any pending (not attached) circs that they should
|
||||||
|
* give up. */
|
||||||
|
circuit_n_conn_done(TO_OR_CONN(conn), 0);
|
||||||
} else if (conn->hold_open_until_flushed) {
|
} else if (conn->hold_open_until_flushed) {
|
||||||
/* XXXX009 We used to have an arg that told us whether we closed the
|
/* XXXX009 We used to have an arg that told us whether we closed the
|
||||||
* connection on purpose or not. Can we use hold_open_until_flushed
|
* connection on purpose or not. Can we use hold_open_until_flushed
|
||||||
@ -452,6 +456,9 @@ connection_about_to_close_connection(connection_t *conn)
|
|||||||
rep_hist_note_connection_died(or_conn->identity_digest, now);
|
rep_hist_note_connection_died(or_conn->identity_digest, now);
|
||||||
control_event_or_conn_status(or_conn, OR_CONN_EVENT_CLOSED);
|
control_event_or_conn_status(or_conn, OR_CONN_EVENT_CLOSED);
|
||||||
}
|
}
|
||||||
|
/* Now close all the attached circuits on it. */
|
||||||
|
circuit_unlink_all_from_or_conn(TO_OR_CONN(conn),
|
||||||
|
END_CIRC_REASON_OR_CONN_CLOSED);
|
||||||
break;
|
break;
|
||||||
case CONN_TYPE_AP:
|
case CONN_TYPE_AP:
|
||||||
edge_conn = TO_EDGE_CONN(conn);
|
edge_conn = TO_EDGE_CONN(conn);
|
||||||
@ -463,20 +470,23 @@ connection_about_to_close_connection(connection_t *conn)
|
|||||||
conn->marked_for_close_file, conn->marked_for_close);
|
conn->marked_for_close_file, conn->marked_for_close);
|
||||||
}
|
}
|
||||||
if (!edge_conn->end_reason) {
|
if (!edge_conn->end_reason) {
|
||||||
// XXXX Disable this before 0.1.2.x-final ships.
|
// XXXX012 Disable this before 0.1.2.x-final ships.
|
||||||
log_warn(LD_BUG,"Bug: Closing stream (marked at %s:%d) without having"
|
log_warn(LD_BUG,"Bug: Closing stream (marked at %s:%d) without having"
|
||||||
" set end_reason. Please tell Nick.",
|
" set end_reason. Please tell Nick.",
|
||||||
conn->marked_for_close_file, conn->marked_for_close);
|
conn->marked_for_close_file, conn->marked_for_close);
|
||||||
}
|
}
|
||||||
control_event_stream_status(edge_conn, STREAM_EVENT_CLOSED,
|
control_event_stream_status(edge_conn, STREAM_EVENT_CLOSED,
|
||||||
edge_conn->end_reason);
|
edge_conn->end_reason);
|
||||||
|
circ = circuit_get_by_edge_conn(edge_conn);
|
||||||
|
if (circ)
|
||||||
|
circuit_detach_stream(circ, edge_conn);
|
||||||
break;
|
break;
|
||||||
case CONN_TYPE_EXIT:
|
case CONN_TYPE_EXIT:
|
||||||
edge_conn = TO_EDGE_CONN(conn);
|
edge_conn = TO_EDGE_CONN(conn);
|
||||||
|
circ = circuit_get_by_edge_conn(edge_conn);
|
||||||
|
if (circ)
|
||||||
|
circuit_detach_stream(circ, edge_conn);
|
||||||
if (conn->state == EXIT_CONN_STATE_RESOLVING) {
|
if (conn->state == EXIT_CONN_STATE_RESOLVING) {
|
||||||
circ = circuit_get_by_edge_conn(edge_conn);
|
|
||||||
if (circ)
|
|
||||||
circuit_detach_stream(circ, edge_conn);
|
|
||||||
connection_dns_remove(edge_conn);
|
connection_dns_remove(edge_conn);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -208,7 +208,6 @@ connection_remove(connection_t *conn)
|
|||||||
static void
|
static void
|
||||||
connection_unlink(connection_t *conn, int remove)
|
connection_unlink(connection_t *conn, int remove)
|
||||||
{
|
{
|
||||||
circuit_about_to_close_connection(conn);
|
|
||||||
connection_about_to_close_connection(conn);
|
connection_about_to_close_connection(conn);
|
||||||
if (remove) {
|
if (remove) {
|
||||||
connection_remove(conn);
|
connection_remove(conn);
|
||||||
|
@ -673,7 +673,8 @@ typedef struct connection_t {
|
|||||||
* conn? */
|
* conn? */
|
||||||
unsigned edge_has_sent_end:1; /**< For debugging; only used on edge
|
unsigned edge_has_sent_end:1; /**< For debugging; only used on edge
|
||||||
* connections. Set once we've set the stream end,
|
* connections. Set once we've set the stream end,
|
||||||
* and check in circuit_about_to_close_connection(). */
|
* and check in connection_about_to_close_connection().
|
||||||
|
*/
|
||||||
/** Used for OR conns that shouldn't get any new circs attached to them. */
|
/** Used for OR conns that shouldn't get any new circs attached to them. */
|
||||||
unsigned int or_is_obsolete:1;
|
unsigned int or_is_obsolete:1;
|
||||||
/** For AP connections only. If 1, and we fail to reach the chosen exit,
|
/** For AP connections only. If 1, and we fail to reach the chosen exit,
|
||||||
@ -1835,7 +1836,6 @@ int circuit_stream_is_being_handled(edge_connection_t *conn, uint16_t port,
|
|||||||
int min);
|
int min);
|
||||||
void circuit_build_needed_circs(time_t now);
|
void circuit_build_needed_circs(time_t now);
|
||||||
void circuit_detach_stream(circuit_t *circ, edge_connection_t *conn);
|
void circuit_detach_stream(circuit_t *circ, edge_connection_t *conn);
|
||||||
void circuit_about_to_close_connection(connection_t *conn);
|
|
||||||
|
|
||||||
void reset_bandwidth_test(void);
|
void reset_bandwidth_test(void);
|
||||||
int circuit_enough_testing_circs(void);
|
int circuit_enough_testing_circs(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user