mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 06:48:05 +01:00
r14051@Kushana: nickm | 2007-08-15 15:55:36 -0400
Fix an XXXX020 and a few DOCDOCs. svn:r11127
This commit is contained in:
parent
abad4dfc7a
commit
181ba71a90
5 changed files with 24 additions and 8 deletions
|
@ -1652,11 +1652,13 @@ struct tor_mutex_t {
|
|||
};
|
||||
#endif
|
||||
|
||||
/* Condition stuff. DOCDOC */
|
||||
/* Conditions. */
|
||||
#ifdef USE_PTHREADS
|
||||
/** Cross-platform condtion implementation. */
|
||||
struct tor_cond_t {
|
||||
pthread_cond_t cond;
|
||||
};
|
||||
/** Return a newly allocated condition, with nobody waiting on it. */
|
||||
tor_cond_t *
|
||||
tor_cond_new(void)
|
||||
{
|
||||
|
@ -1667,6 +1669,7 @@ tor_cond_new(void)
|
|||
}
|
||||
return cond;
|
||||
}
|
||||
/** Release all resources held by <b>cond</b>. */
|
||||
void
|
||||
tor_conf_free(tor_cond_t *cond)
|
||||
{
|
||||
|
@ -1677,21 +1680,27 @@ tor_conf_free(tor_cond_t *cond)
|
|||
}
|
||||
tor_free(cond);
|
||||
}
|
||||
/** Wait until one of the tor_cond_signal functions is called on <b>cond</b>.
|
||||
* All waiters on the condition must wait holding the same <b>mutex</b>.
|
||||
* Returns 0 on success, negative on failure. */
|
||||
int
|
||||
tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex)
|
||||
{
|
||||
return pthread_cond_wait(&cond->cond, &mutex->mutex) ? -1 : 0;
|
||||
}
|
||||
/** Wake up one of the waiters on <b>cond</b>. */
|
||||
void
|
||||
tor_cond_signal_one(tor_cond_t *cond)
|
||||
{
|
||||
pthread_cond_signal(&cond->cond);
|
||||
}
|
||||
/** Wake up all of the waiters on <b>cond</b>. */
|
||||
void
|
||||
tor_cond_signal_all(tor_cond_t *cond)
|
||||
{
|
||||
pthread_cond_broadcast(&cond->cond);
|
||||
}
|
||||
/** Set up common structures for use by threading. */
|
||||
void
|
||||
tor_threads_init(void)
|
||||
{
|
||||
|
|
|
@ -216,7 +216,8 @@ _tor_free(void *mem)
|
|||
tor_free(mem);
|
||||
}
|
||||
|
||||
/** DOCDOC */
|
||||
/** Call the platform malloc info function, and dump the results to the log at
|
||||
* level <b>severity</b>. If no such function exists, do nothing. */
|
||||
void
|
||||
tor_log_mallinfo(int severity)
|
||||
{
|
||||
|
|
|
@ -3086,8 +3086,10 @@ control_event_descriptors_changed(smartlist_t *routers)
|
|||
}
|
||||
|
||||
/** Called whenever an address mapping on <b>from<b> from changes to <b>to</b>.
|
||||
* <b>expires</b> values less than 3 are special; see connection_edge.c.
|
||||
* DOCDOC source. */
|
||||
* <b>expires</b> values less than 3 are special; see connection_edge.c. If
|
||||
* <b>error</b> is nonempty, it is an error code describing the failure
|
||||
* mode of the mapping.
|
||||
*/
|
||||
int
|
||||
control_event_address_mapped(const char *from, const char *to, time_t expires,
|
||||
const char *error)
|
||||
|
|
|
@ -1637,7 +1637,8 @@ write_http_response_header_impl(dir_connection_t *conn, ssize_t length,
|
|||
connection_write_to_buf(tmp, strlen(tmp), TO_CONN(conn));
|
||||
}
|
||||
|
||||
/** DOCDOC */
|
||||
/** As write_http_response_header_impl, but sets encoding and content-typed
|
||||
* based on whether the response will be <b>deflated</b> or not. */
|
||||
static void
|
||||
write_http_response_header(dir_connection_t *conn, ssize_t length,
|
||||
int deflated, int cache_lifetime)
|
||||
|
|
|
@ -3893,9 +3893,12 @@ networkstatus_get_latest_consensus(void)
|
|||
networkstatus_vote_t *
|
||||
networkstatus_get_live_consensus(time_t now)
|
||||
{
|
||||
/* XXXX020 check for liveness */
|
||||
(void)now;
|
||||
return current_consensus;
|
||||
if (current_consensus &&
|
||||
current_consensus->valid_after <= now &&
|
||||
now <= current_consensus->valid_until)
|
||||
return current_consensus;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** DOCDOC */
|
||||
|
|
Loading…
Add table
Reference in a new issue