Merge branch 'maint-0.2.2' into release-0.2.2
This commit is contained in:
commit
80466eb215
|
@ -0,0 +1,4 @@
|
|||
o Minor bugfixes:
|
||||
- Added a forgotten cast that caused a compile warning on OS X 10.6. Bugfix
|
||||
on 0.2.2.24-alpha.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
o Unit tests:
|
||||
- Use GetTempDir to find the proper temporary directory location on
|
||||
Windows when generating temporary files for the unit tests. Patch
|
||||
by Gisle Vanem.
|
|
@ -363,7 +363,7 @@ logv(int severity, log_domain_mask_t domain, const char *funcname,
|
|||
continue;
|
||||
} else if (lf->callback) {
|
||||
if (domain & LD_NOCB) {
|
||||
if (!callbacks_deferred) {
|
||||
if (!callbacks_deferred && pending_cb_messages) {
|
||||
pending_cb_message_t *msg = tor_malloc(sizeof(pending_cb_message_t));
|
||||
msg->severity = severity;
|
||||
msg->domain = domain;
|
||||
|
@ -512,9 +512,12 @@ void
|
|||
logs_free_all(void)
|
||||
{
|
||||
logfile_t *victim, *next;
|
||||
smartlist_t *messages;
|
||||
LOCK_LOGS();
|
||||
next = logfiles;
|
||||
logfiles = NULL;
|
||||
messages = pending_cb_messages;
|
||||
pending_cb_messages = NULL;
|
||||
UNLOCK_LOGS();
|
||||
while (next) {
|
||||
victim = next;
|
||||
|
@ -524,6 +527,12 @@ logs_free_all(void)
|
|||
}
|
||||
tor_free(appname);
|
||||
|
||||
SMARTLIST_FOREACH(messages, pending_cb_message_t *, msg, {
|
||||
tor_free(msg->msg);
|
||||
tor_free(msg);
|
||||
});
|
||||
smartlist_free(messages);
|
||||
|
||||
/* We _could_ destroy the log mutex here, but that would screw up any logs
|
||||
* that happened between here and the end of execution. */
|
||||
}
|
||||
|
|
|
@ -2330,14 +2330,19 @@ rep_hist_buffer_stats_init(time_t now)
|
|||
start_of_buffer_stats_interval = now;
|
||||
}
|
||||
|
||||
/** Statistics from a single circuit. Collected when the circuit closes, or
|
||||
* when we flush statistics to disk. */
|
||||
typedef struct circ_buffer_stats_t {
|
||||
uint32_t processed_cells;
|
||||
/** Average number of cells in the circuit's queue */
|
||||
double mean_num_cells_in_queue;
|
||||
/** Average time a cell waits in the queue. */
|
||||
double mean_time_cells_in_queue;
|
||||
uint32_t local_circ_id;
|
||||
/** Total number of cells sent over this circuit */
|
||||
uint32_t processed_cells;
|
||||
} circ_buffer_stats_t;
|
||||
|
||||
smartlist_t *circuits_for_buffer_stats = NULL;
|
||||
/** List of circ_buffer_stats_t. */
|
||||
static smartlist_t *circuits_for_buffer_stats = NULL;
|
||||
|
||||
/** Remember cell statistics for circuit <b>circ</b> at time
|
||||
* <b>end_of_interval</b> and reset cell counters in case the circuit
|
||||
|
@ -2361,6 +2366,8 @@ rep_hist_buffer_stats_add_circ(circuit_t *circ, time_t end_of_interval)
|
|||
circ->timestamp_created.tv_sec :
|
||||
start_of_buffer_stats_interval;
|
||||
interval_length = (int) (end_of_interval - start_of_interval);
|
||||
if (interval_length <= 0)
|
||||
return;
|
||||
stat = tor_malloc_zero(sizeof(circ_buffer_stats_t));
|
||||
stat->processed_cells = orcirc->processed_cells;
|
||||
/* 1000.0 for s -> ms; 2.0 because of app-ward and exit-ward queues */
|
||||
|
@ -2538,5 +2545,11 @@ rep_hist_free_all(void)
|
|||
tor_free(exit_streams);
|
||||
built_last_stability_doc_at = 0;
|
||||
predicted_ports_free();
|
||||
if (circuits_for_buffer_stats) {
|
||||
SMARTLIST_FOREACH(circuits_for_buffer_stats, circ_buffer_stats_t *, s,
|
||||
tor_free(s));
|
||||
smartlist_free(circuits_for_buffer_stats);
|
||||
circuits_for_buffer_stats = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,10 +84,16 @@ setup_directory(void)
|
|||
if (is_setup) return;
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
// XXXX
|
||||
tor_snprintf(temp_dir, sizeof(temp_dir),
|
||||
"c:\\windows\\temp\\tor_test_%d", (int)getpid());
|
||||
r = mkdir(temp_dir);
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
const char *tmp = buf;
|
||||
/* If this fails, we're probably screwed anyway */
|
||||
if (!GetTempPath(sizeof(buf),buf))
|
||||
tmp = "c:\\windows\\temp";
|
||||
tor_snprintf(temp_dir, sizeof(temp_dir),
|
||||
"%s\\tor_test_%d", tmp, (int)getpid());
|
||||
r = mkdir(temp_dir);
|
||||
}
|
||||
#else
|
||||
tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d", (int) getpid());
|
||||
r = mkdir(temp_dir, 0700);
|
||||
|
|
Loading…
Reference in New Issue