From 7c7bb8b97ed1fd012fd8cd4cf16217a1757621ec Mon Sep 17 00:00:00 2001 From: David Goulet Date: Fri, 29 May 2015 17:45:45 -0400 Subject: Refactor rend_services_introduce() The reasoning for refactoring this function is that removing the introduction point adaptative algorithm (#4862) ended up changing quite a bit rend_services_introduce(). Also, to fix some open issues (#8239, #8864 and #13483), this work had to be done. First, this removes time_expiring variable in an intro point object and INTRO_POINT_EXPIRATION_GRACE_PERIOD trickery and use an expiring_nodes list where intro nodes that should expire are moved to that list and cleaned up only once the new descriptor is successfully uploaded. The previous scheme was adding complexity and arbitrary timing to when we expire an intro point. We keep the intro points until we are sure that the new descriptor is uploaded and thus ready to be used by clients. For this, rend_service_desc_has_uploaded() is added to notify the HS subsystem that the descriptor has been successfully uploaded. The purpose of this function is to cleanup the expiring nodes and circuits if any. Secondly, this adds the remove_invalid_intro_points() function in order to split up rend_services_introduce() a bit with an extra modification to it that fixes #8864. We do NOT close the circuit nor delete the intro point if the circuit is still alive but the node was removed from the consensus. Due to possible information leak, we let the circuit and intro point object expire instead. Finally, the whole code flow is simplified and large amount of documentation has been added to mostly explain the why of things in there. Fixes #8864 Signed-off-by: David Goulet --- src/or/directory.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/or/directory.c') diff --git a/src/or/directory.c b/src/or/directory.c index 549d95a13c..8d7f9f4dea 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -23,6 +23,7 @@ #include "relay.h" #include "rendclient.h" #include "rendcommon.h" +#include "rendservice.h" #include "rephist.h" #include "router.h" #include "routerlist.h" @@ -2196,6 +2197,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) "Uploading rendezvous descriptor: finished with status " "200 (%s)", escaped(reason)); control_event_hs_descriptor_uploaded(conn->identity_digest); + rend_service_desc_has_uploaded(conn->rend_data); break; case 400: log_warn(LD_REND,"http status 400 (%s) response from dirserver " -- cgit v1.2.3-54-g00ecf