Fix an XXXX020 and a few DOCDOCs.
svn:r11127
};
#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)
{
}
return cond;
}
+/** Release all resources held by <b>cond</b>. */
void
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)
{
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)
{
}
/** 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)
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)
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 */