[or-cvs] And some documentation before bed.

Nick Mathewson nickm at seul.org
Thu Sep 15 06:15:33 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv23997/src/or

Modified Files:
	directory.c dirserv.c routerlist.c 
Log Message:
And some documentation before bed.

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.277
retrieving revision 1.278
diff -u -d -r1.277 -r1.278
--- directory.c	15 Sep 2005 05:19:38 -0000	1.277
+++ directory.c	15 Sep 2005 06:15:31 -0000	1.278
@@ -1557,7 +1557,7 @@
 }
 
 /** Called when one or more networkstatus fetches have failed (with uppercase
- * fingerprints listed in <b>fp</>).  Mark those fingerprints has having
+ * fingerprints listed in <b>failed</>).  Mark those fingerprints has having
  * failed once. */
 static void
 dir_networkstatus_download_failed(smartlist_t *failed)
@@ -1573,7 +1573,8 @@
   });
 }
 
-/* DOCDOC */
+/** Called when one or more networkstatus fetches have failed (with uppercase
+ * fingerprints listed in <b>failed</>). */
 static void
 dir_routerdesc_download_failed(smartlist_t *failed)
 {

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -d -r1.231 -r1.232
--- dirserv.c	15 Sep 2005 05:19:38 -0000	1.231
+++ dirserv.c	15 Sep 2005 06:15:31 -0000	1.232
@@ -165,8 +165,10 @@
 
 /** Check whether <b>router</b> has a nickname/identity key combination that
  * we recognize from the fingerprint list, or an IP we automatically act on
- * according to our configuration.  Return the appropriate disposition.
- * DOCDOC msg is set on reject, if provided.
+ * according to our configuration.  Return the appropriate router status.
+ *
+ * If the status is 'FP_REJECT' and <b>msg</b> is provided, set
+ * *<b>msg</b> to an explanation of why.
  */
 static router_status_t
 dirserv_router_get_status(const routerinfo_t *router, const char **msg)
@@ -287,7 +289,8 @@
 /** Check whether we, as a directory server, want to accept <b>ri</b>.  If so,
  * return 0, and set its is_valid,named,running fields.  Otherwise, return -1.
  *
- * DOCDOC msg
+ * If the router is rejected and <b>msg</b> is provided, set
+ * *<b>msg</b> to an explanation of why.
  */
 int
 authdir_wants_to_reject_router(routerinfo_t *ri,
@@ -595,7 +598,9 @@
   return 0;
 }
 
-/* DOCDOC */
+/** Helper: Given pointers to two strings describing tor versions, return -1
+ * if _a precedes _b, 1 if _b preceeds _a, and 0 if they are equivalent.
+ * Used to sort a list of versions. */
 static int
 _compare_tor_version_str_ptr(const void **_a, const void **_b)
 {
@@ -620,7 +625,8 @@
 /* Given a (possibly empty) list of config_line_t, each line of which contains
  * a list of comma-separated version numbers surrounded by optional space,
  * allocate and return a new string containing the version numbers, in order,
- * separated by commas.  Used to generate Recommended(Client|Server)?Versions */
+ * separated by commas.  Used to generate Recommended(Client|Server)?Versions
+ */
 static char *
 format_versions_list(config_line_t *ln)
 {

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -d -r1.293 -r1.294
--- routerlist.c	15 Sep 2005 05:41:30 -0000	1.293
+++ routerlist.c	15 Sep 2005 06:15:31 -0000	1.294
@@ -211,7 +211,9 @@
   return r;
 }
 
-/* DOCDOC */
+/* Load all cached router descriptors from the store. Return 0 on success and
+ * -1 on failure.
+ */
 int
 router_reload_router_list(void)
 {
@@ -1072,7 +1074,7 @@
 }
 
 /** Add <b>router</b> to the routerlist, if we don't already have it.  Replace
- * older entries (if any) with the same name.  Note: Callers should not hold
+ * older entries (if any) with the same key.  Note: Callers should not hold
  * their pointers to <b>router</b> if this function fails; <b>router</b>
  * will either be inserted into the routerlist or freed.
  *
@@ -1087,9 +1089,9 @@
  * routerinfo was accepted, but we should notify the generator of the
  * descriptor using the message *<b>msg</b>.
  *
- * DOCDOC very changed.  Also, MUST call update_status_from_networkstatus
- * first, and should call router_rebuild_store and
- * control_event_descriptors_changed after.
+ * This function should be called *after*
+ * routers_update_status_from_networkstatus; subsequenctly, you should call
+ * router_rebuild_store and control_event_descriptors_changed.
  *
  * XXXX never replace your own descriptor.
  */
@@ -1286,7 +1288,15 @@
   return 1;
 }
 
-/* DOCDOC */
+/** Given a string <b>s</b> containing some routerdescs, parse it and put the
+ * routers into our directory.  If <b>from_cache</b> is false, the routers
+ * have come from the network: cache them.
+ *
+ * If <b>requested_fingerprints</b> is provided, it must contain a list of
+ * uppercased identity fingerprints.  Do not update any router whose
+ * fingerprint is not on the list; after updating a router, remove its
+ * fingerprint from the list.
+ */
 void
 router_load_routers_from_string(const char *s, int from_cache,
                                 smartlist_t *requested_fingerprints)
@@ -1422,7 +1432,7 @@
  * fingerprint is not on the list; after updating a networkstatus, remove its
  * fingerprint from the list.
  *
- * Return 0 on success, -1 on failure.
+o * Return 0 on success, -1 on failure.
  */
 int
 router_set_networkstatus(const char *s, time_t arrived_at,
@@ -2402,7 +2412,14 @@
   return superseded;
 }
 
-/* DOCDOC */
+/** Initiate new router downloads as needed.
+ *
+ * We only allow one router descriptor download at a time.
+ * If we have less than two network-status documents, we ask
+ * a directory for "all descriptors."
+ * Otherwise, we ask for all descriptors that we think are different
+ * from what we have.
+ */
 void
 update_router_descriptor_downloads(time_t now)
 {
@@ -2438,7 +2455,9 @@
   tor_free(resource);
 }
 
-/* DOCDOC */
+/** Return true iff we have enough networkstatus and router information to
+ * start building circuits.  Right now, this means "at least 2 networkstatus
+ * documents, and at least 1/4 of expected routers." */
 int
 router_have_minimum_dir_info(void)
 {



More information about the tor-commits mailing list