[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11127: Fix an XXXX020 and a few DOCDOCs. (in tor/trunk: . src/common src/or)
Author: nickm
Date: 2007-08-15 15:56:01 -0400 (Wed, 15 Aug 2007)
New Revision: 11127
Modified:
tor/trunk/
tor/trunk/src/common/compat.c
tor/trunk/src/common/util.c
tor/trunk/src/or/control.c
tor/trunk/src/or/directory.c
tor/trunk/src/or/routerlist.c
Log:
r14051@Kushana: nickm | 2007-08-15 15:55:36 -0400
Fix an XXXX020 and a few DOCDOCs.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r14051] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/common/compat.c
===================================================================
--- tor/trunk/src/common/compat.c 2007-08-15 19:55:57 UTC (rev 11126)
+++ tor/trunk/src/common/compat.c 2007-08-15 19:56:01 UTC (rev 11127)
@@ -1652,11 +1652,13 @@
};
#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 @@
}
return cond;
}
+/** Release all resources held by <b>cond</b>. */
void
tor_conf_free(tor_cond_t *cond)
{
@@ -1677,21 +1680,27 @@
}
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)
{
Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c 2007-08-15 19:55:57 UTC (rev 11126)
+++ tor/trunk/src/common/util.c 2007-08-15 19:56:01 UTC (rev 11127)
@@ -216,7 +216,8 @@
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)
{
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2007-08-15 19:55:57 UTC (rev 11126)
+++ tor/trunk/src/or/control.c 2007-08-15 19:56:01 UTC (rev 11127)
@@ -3086,8 +3086,10 @@
}
/** 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)
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2007-08-15 19:55:57 UTC (rev 11126)
+++ tor/trunk/src/or/directory.c 2007-08-15 19:56:01 UTC (rev 11127)
@@ -1637,7 +1637,8 @@
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)
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2007-08-15 19:55:57 UTC (rev 11126)
+++ tor/trunk/src/or/routerlist.c 2007-08-15 19:56:01 UTC (rev 11127)
@@ -3893,9 +3893,12 @@
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 */