Record which intro points were listed in the last HS desc

This commit is contained in:
Robert Ransom 2011-10-13 08:48:31 -07:00
parent 6f035cb2b4
commit 3f6a2d3e2a
2 changed files with 11 additions and 0 deletions

View File

@ -3481,6 +3481,10 @@ typedef struct rend_intro_point_t {
* circuit-build timeout. See also MAX_INTRO_POINT_REACHABILITY_FAILURES. */ * circuit-build timeout. See also MAX_INTRO_POINT_REACHABILITY_FAILURES. */
unsigned int unreachable_count : 3; unsigned int unreachable_count : 3;
/** (Service side only) Flag indicating that this intro point was
* included in the last HS descriptor we generated. */
unsigned int listed_in_last_desc : 1;
/** (Service side only) The number of INTRODUCE2 cells this intro /** (Service side only) The number of INTRODUCE2 cells this intro
* point's circuit has received. */ * point's circuit has received. */
unsigned int introduction_count : 24; unsigned int introduction_count : 24;

View File

@ -544,10 +544,17 @@ rend_service_update_descriptor(rend_service_t *service)
for (i = 0; i < smartlist_len(service->intro_nodes); ++i) { for (i = 0; i < smartlist_len(service->intro_nodes); ++i) {
rend_intro_point_t *intro_svc = smartlist_get(service->intro_nodes, i); rend_intro_point_t *intro_svc = smartlist_get(service->intro_nodes, i);
rend_intro_point_t *intro_desc; rend_intro_point_t *intro_desc;
/* This intro point won't be listed in the descriptor... */
intro_svc->listed_in_last_desc = 0;
circ = find_intro_circuit(intro_svc, service->pk_digest); circ = find_intro_circuit(intro_svc, service->pk_digest);
if (!circ || circ->_base.purpose != CIRCUIT_PURPOSE_S_INTRO) if (!circ || circ->_base.purpose != CIRCUIT_PURPOSE_S_INTRO)
continue; continue;
/* ...unless this intro point is listed in the descriptor. */
intro_svc->listed_in_last_desc = 1;
/* We have an entirely established intro circuit. Publish it in /* We have an entirely established intro circuit. Publish it in
* our descriptor. */ * our descriptor. */
intro_desc = tor_malloc_zero(sizeof(rend_intro_point_t)); intro_desc = tor_malloc_zero(sizeof(rend_intro_point_t));