has gone wrong with our network and abandon all not-yet-used circs.
svn:r3792
return 0;
}
+void circuit_note_clock_jumped(int seconds_elapsed) {
+ log_fn(LOG_NOTICE,"Your clock just jumped %d seconds forward; assuming established circuits no longer work.", seconds_elapsed);
+ has_completed_circuit=0; /* so it'll log when it works again */
+ circuit_mark_all_unused_circs();
+}
+
/** Take the 'extend' cell, pull out addr/port plus the onion skin. Make
* sure we're connected to the next hop, and pass it the onion skin in
* a create cell.
return best;
}
+/** Go through the circuitlist; mark-for-close each circuit that starts
+ * at us but has not yet been used. */
+void circuit_mark_all_unused_circs(void) {
+ circuit_t *circ;
+
+ for (circ=global_circuitlist; circ; circ = circ->next) {
+ if (CIRCUIT_IS_ORIGIN(circ) &&
+ !circ->marked_for_close &&
+ !circ->timestamp_dirty)
+ circuit_mark_for_close(circ);
+ }
+}
+
/** Mark <b>circ</b> to be closed next time we call
* circuit_close_all_marked(). Do any cleanup needed:
* - If state is onionskin_pending, remove circ from the onion_pending
stats_prev_global_write_bucket = global_write_bucket;
/* if more than 10s have elapsed, probably the clock jumped: doesn't count. */
- if (seconds_elapsed < 10)
+ if (seconds_elapsed < 100)
stats_n_seconds_working += seconds_elapsed;
+ else
+ circuit_note_clock_jumped(seconds_elapsed);
assert_all_pending_dns_resolves_ok();
run_scheduled_events(now.tv_sec);
int need_uptime, int need_capacity, int internal);
void circuit_n_conn_done(connection_t *or_conn, int status);
int circuit_send_next_onion_skin(circuit_t *circ);
+void circuit_note_clock_jumped(int seconds_elapsed);
int circuit_extend(cell_t *cell, circuit_t *circ);
int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse);
int circuit_finish_handshake(circuit_t *circ, char *reply);
circuit_t *circuit_get_rendezvous(const char *cookie);
circuit_t *circuit_get_clean_open(uint8_t purpose, int need_uptime,
int need_capacity, int internal);
+void circuit_mark_all_unused_circs(void);
int _circuit_mark_for_close(circuit_t *circ);
#define circuit_mark_for_close(c) \