summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-08-30 09:15:54 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-08-30 09:15:54 -0400
commit22295759afa90f19b06e2b657ce84d518c2390fd (patch)
tree87ab2f6eeca8091e4c775c031910863b918077b3 /src/or/connection.c
parent209bfe715cc8c1c59b2578c406749a0d4a5bd8cb (diff)
downloadtor-22295759afa90f19b06e2b657ce84d518c2390fd.tar.gz
tor-22295759afa90f19b06e2b657ce84d518c2390fd.zip
prop224: Purge client state on NEWNYM
Closes #23355 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 31a682387d..01d7752e8d 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -4113,16 +4113,27 @@ connection_write_to_buf_impl_,(const char *string, size_t len,
return ret_conns; \
STMT_END
-/* Return a list of connections that aren't close and matches the given state.
- * The returned list can be empty and must be freed using smartlist_free().
- * The caller does NOT have owernship of the objects in the list so it must
- * not free them nor reference them as they can disapear. */
+/* Return a list of connections that aren't close and matches the given type
+ * and state. The returned list can be empty and must be freed using
+ * smartlist_free(). The caller does NOT have owernship of the objects in the
+ * list so it must not free them nor reference them as they can disappear. */
smartlist_t *
connection_list_by_type_state(int type, int state)
{
CONN_GET_ALL_TEMPLATE(conn, (conn->type == type && conn->state == state));
}
+/* Return a list of connections that aren't close and matches the given type
+ * and purpose. The returned list can be empty and must be freed using
+ * smartlist_free(). The caller does NOT have owernship of the objects in the
+ * list so it must not free them nor reference them as they can disappear. */
+smartlist_t *
+connection_list_by_type_purpose(int type, int purpose)
+{
+ CONN_GET_ALL_TEMPLATE(conn,
+ (conn->type == type && conn->purpose == purpose));
+}
+
/** Return a connection_t * from get_connection_array() that satisfies test on
* var, and that is not marked for close. */
#define CONN_GET_TEMPLATE(var, test) \