aboutsummaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-09-27 20:46:30 +0000
committerNick Mathewson <nickm@torproject.org>2007-09-27 20:46:30 +0000
commitb5c8a8ae53c141c14651485794999910d0168be8 (patch)
tree5a698b0cdf8502c9c945cd9f70cb00e1a96d9625 /src/or/control.c
parent2050b31bb90861c6cbf8cfc54299f5a7f10609a2 (diff)
downloadtor-b5c8a8ae53c141c14651485794999910d0168be8.tar.gz
tor-b5c8a8ae53c141c14651485794999910d0168be8.zip
r15422@catbus: nickm | 2007-09-27 16:42:35 -0400
Use descriptor annotations to record the source, download t time, and purpose of every descriptor we add to the store. The remaining to-do item is to stop setting do_not_cache on bridges. svn:r11680
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 0faaa502a1..aa4d6af775 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1884,12 +1884,18 @@ get_purpose(char **string, int for_circuits, uint8_t *purpose)
if (!strcmpstart(*string, "purpose="))
*string += strlen("purpose=");
+ if (!for_circuits) {
+ int r = router_purpose_from_string(*string);
+ if (r == ROUTER_PURPOSE_UNKNOWN)
+ return -1;
+ *purpose = r;
+ return 0;
+ }
+
if (!strcmp(*string, "general"))
- *purpose = for_circuits ? CIRCUIT_PURPOSE_C_GENERAL :
- ROUTER_PURPOSE_GENERAL;
+ *purpose = CIRCUIT_PURPOSE_C_GENERAL;
else if (!strcmp(*string, "controller"))
- *purpose = for_circuits ? CIRCUIT_PURPOSE_CONTROLLER :
- ROUTER_PURPOSE_CONTROLLER;
+ *purpose = CIRCUIT_PURPOSE_CONTROLLER;
else { /* not a recognized purpose */
return -1;
}