summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-08-15 19:56:01 +0000
committerNick Mathewson <nickm@torproject.org>2007-08-15 19:56:01 +0000
commit181ba71a90359f67e90664be290af4d0ed57db8d (patch)
treed80ac2bbf3ea6a59a1a7c57ba1675215a8e83aac
parentabad4dfc7aa0f98d3dc63470934f181aaec78807 (diff)
downloadtor-181ba71a90359f67e90664be290af4d0ed57db8d.tar.gz
tor-181ba71a90359f67e90664be290af4d0ed57db8d.zip
r14051@Kushana: nickm | 2007-08-15 15:55:36 -0400
Fix an XXXX020 and a few DOCDOCs. svn:r11127
-rw-r--r--src/common/compat.c11
-rw-r--r--src/common/util.c3
-rw-r--r--src/or/control.c6
-rw-r--r--src/or/directory.c3
-rw-r--r--src/or/routerlist.c9
5 files changed, 24 insertions, 8 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 0becc00be7..ebddce74b1 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -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)
{
diff --git a/src/common/util.c b/src/common/util.c
index d22fce57a7..006eeb68d6 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -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)
{
diff --git a/src/or/control.c b/src/or/control.c
index 1a91562ad6..d210428a4d 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -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)
diff --git a/src/or/directory.c b/src/or/directory.c
index d465720c6b..3e3433718b 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -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)
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f7caaa024b..5bc0bb6d4c 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -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 */