mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Function to cancel a guard state.
We'll want to use this if we allocate a guard state then decide, "whoops, we don't want to use this."
This commit is contained in:
@@ -1347,6 +1347,29 @@ entry_guard_succeeded(guard_selection_t *gs,
|
||||
}
|
||||
}
|
||||
|
||||
/** Cancel the selection of *<b>guard_state_p</b> without declaring
|
||||
* success or failure. It is safe to call this function if success or
|
||||
* failure _has_ already been declared. */
|
||||
void
|
||||
entry_guard_cancel(guard_selection_t *gs,
|
||||
circuit_guard_state_t **guard_state_p)
|
||||
{
|
||||
(void) gs;
|
||||
if (get_options()->UseDeprecatedGuardAlgorithm)
|
||||
return;
|
||||
if (BUG(*guard_state_p == NULL))
|
||||
return;
|
||||
entry_guard_t *guard = entry_guard_handle_get((*guard_state_p)->guard);
|
||||
if (! guard)
|
||||
return;
|
||||
|
||||
/* XXXX prop271 -- last_tried_to_connect_at will be erroneous here, but this
|
||||
* function will only get called in "bug" cases anyway. */
|
||||
guard->is_pending = 0;
|
||||
circuit_guard_state_free(*guard_state_p);
|
||||
*guard_state_p = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the circuit building module when a circuit has succeeded:
|
||||
* informs the guards code that the guard in *<b>guard_state_p</b> is
|
||||
|
||||
@@ -322,6 +322,8 @@ int entry_guard_succeeded(guard_selection_t *gs,
|
||||
circuit_guard_state_t **guard_state_p);
|
||||
void entry_guard_failed(guard_selection_t *gs,
|
||||
circuit_guard_state_t **guard_state_p);
|
||||
void entry_guard_cancel(guard_selection_t *gs,
|
||||
circuit_guard_state_t **guard_state_p);
|
||||
void entry_guard_chan_failed(guard_selection_t *gs,
|
||||
channel_t *chan);
|
||||
void entry_guards_update_all(guard_selection_t *gs);
|
||||
|
||||
Reference in New Issue
Block a user