mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
a bit more code cleanup
svn:r5033
This commit is contained in:
parent
890847d232
commit
26cc51ffea
@ -458,6 +458,26 @@ circuit_deliver_create_cell(circuit_t *circ, uint8_t cell_type, char *payload)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** We've decided to start our reachability testing. If all
|
||||||
|
* is set, log this to the user. Return 1 if we did, or 0 if
|
||||||
|
* we chose not to log anything. */
|
||||||
|
int
|
||||||
|
inform_testing_reachability(void)
|
||||||
|
{
|
||||||
|
char dirbuf[128];
|
||||||
|
routerinfo_t *me = router_get_my_routerinfo();
|
||||||
|
if (!me)
|
||||||
|
return 0;
|
||||||
|
if (me->dir_port)
|
||||||
|
tor_snprintf(dirbuf, sizeof(dirbuf), " and DirPort %s:%d",
|
||||||
|
me->address, me->dir_port);
|
||||||
|
log(LOG_NOTICE,"Now checking whether ORPort %s:%d%s %s reachable... (this may take several minutes)",
|
||||||
|
me->address, me->or_port,
|
||||||
|
me->dir_port ? dirbuf : "",
|
||||||
|
me->dir_port ? "are" : "is");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
extern int has_completed_circuit;
|
extern int has_completed_circuit;
|
||||||
|
|
||||||
/** This is the backbone function for building circuits.
|
/** This is the backbone function for building circuits.
|
||||||
@ -531,20 +551,10 @@ circuit_send_next_onion_skin(circuit_t *circ)
|
|||||||
if (!has_completed_circuit) {
|
if (!has_completed_circuit) {
|
||||||
or_options_t *options = get_options();
|
or_options_t *options = get_options();
|
||||||
has_completed_circuit=1;
|
has_completed_circuit=1;
|
||||||
/* XXX009 Log a count of known routers here */
|
/* FFFF Log a count of known routers here */
|
||||||
log(LOG_NOTICE,"Tor has successfully opened a circuit. Looks like it's working.");
|
log(LOG_NOTICE,"Tor has successfully opened a circuit. Looks like it's working.");
|
||||||
if (server_mode(options) && !check_whether_orport_reachable()) {
|
if (server_mode(options) && !check_whether_orport_reachable()) {
|
||||||
char dirbuf[128];
|
inform_testing_reachability();
|
||||||
routerinfo_t *me = router_get_my_routerinfo();
|
|
||||||
if (me) {
|
|
||||||
if (me->dir_port)
|
|
||||||
tor_snprintf(dirbuf, sizeof(dirbuf), " and DirPort %s:%d",
|
|
||||||
me->address, me->dir_port);
|
|
||||||
log(LOG_NOTICE,"Now checking whether ORPort %s:%d%s %s reachable... (this may take several minutes)",
|
|
||||||
me->address, me->or_port,
|
|
||||||
me->dir_port ? dirbuf : "",
|
|
||||||
me->dir_port ? "are" : "is");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
circuit_rep_hist_note_result(circ);
|
circuit_rep_hist_note_result(circ);
|
||||||
|
@ -413,10 +413,10 @@ accounting_run_housekeeping(time_t now)
|
|||||||
}
|
}
|
||||||
if (time_to_record_bandwidth_usage(now)) {
|
if (time_to_record_bandwidth_usage(now)) {
|
||||||
if (accounting_record_bandwidth_usage(now)) {
|
if (accounting_record_bandwidth_usage(now)) {
|
||||||
log_fn(LOG_ERR, "Couldn't record bandwidth usage; exiting.");
|
log_fn(LOG_ERR, "Couldn't record bandwidth usage to disk; exiting.");
|
||||||
/* XXX this can fail when you're out of fd's, causing a crash.
|
/* This can fail when we're out of fd's, causing a crash.
|
||||||
* Perhaps the better answer is to hold the file open all the
|
* The current answer is to reserve 32 more than we need, in
|
||||||
* time? */
|
* set_max_file_descriptors(). */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user