Merge branches 'bug8185_031' and 'bug8185_diagnostic_032'

This commit is contained in:
Nick Mathewson
2017-09-29 17:26:40 -04:00
3 changed files with 30 additions and 1 deletions
+20 -1
View File
@@ -495,12 +495,25 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
{
channel_t *chan; /* where to send the cell */
if (circ->marked_for_close) {
/* Circuit is marked; send nothing. */
return 0;
}
if (cell_direction == CELL_DIRECTION_OUT) {
crypt_path_t *thishop; /* counter for repeated crypts */
chan = circ->n_chan;
if (!chan) {
log_warn(LD_BUG,"outgoing relay cell sent from %s:%d has n_chan==NULL."
" Dropping.", filename, lineno);
" Dropping. Circuit is in state %s (%d), and is "
"%smarked for close. (%s:%d, %d)", filename, lineno,
circuit_state_to_string(circ->state), circ->state,
circ->marked_for_close ? "" : "not ",
circ->marked_for_close_file?circ->marked_for_close_file:"",
circ->marked_for_close, circ->marked_for_close_reason);
if (CIRCUIT_IS_ORIGIN(circ)) {
circuit_log_path(LOG_WARN, LD_BUG, TO_ORIGIN_CIRCUIT(circ));
}
log_backtrace(LOG_WARN,LD_BUG,"");
return 0; /* just drop it */
}
@@ -810,6 +823,12 @@ connection_edge_send_command(edge_connection_t *fromconn,
return -1;
}
if (circ->marked_for_close) {
/* The circuit has been marked, but not freed yet. When it's freed, it
* will mark this connection for close. */
return -1;
}
#ifdef MEASUREMENTS_21206
/* Keep track of the number of RELAY_DATA cells sent for directory
* connections. */