aboutsummaryrefslogtreecommitdiff
path: root/src/or/hs_common.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-07-31 17:59:12 +0300
committerNick Mathewson <nickm@torproject.org>2017-08-08 20:29:35 -0400
commit5c4f4acedb8600769889cdff0940806c27b679bd (patch)
treed0baa9c76f9f1319643ff2b3b38607f87cbab716 /src/or/hs_common.c
parent400ba2f636edf5afb14fe3b57f23d80e433d893d (diff)
downloadtor-5c4f4acedb8600769889cdff0940806c27b679bd.tar.gz
tor-5c4f4acedb8600769889cdff0940806c27b679bd.zip
prop224: Function to inc/decrement num rendezvous stream
Add a common function for both legacy and prop224 hidden service to increment and decrement the rendezvous stream counter on an origin circuit. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_common.c')
-rw-r--r--src/or/hs_common.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index 2b637eb780..0d3d41b7cd 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -1333,3 +1333,37 @@ hs_free_all(void)
hs_cache_free_all();
}
+/* For the given origin circuit circ, decrement the number of rendezvous
+ * stream counter. This handles every hidden service version. */
+void
+hs_dec_rdv_stream_counter(origin_circuit_t *circ)
+{
+ tor_assert(circ);
+
+ if (circ->rend_data) {
+ circ->rend_data->nr_streams--;
+ } else if (circ->hs_ident) {
+ circ->hs_ident->num_rdv_streams--;
+ } else {
+ /* Should not be called if this circuit is not for hidden service. */
+ tor_assert_nonfatal_unreached();
+ }
+}
+
+/* For the given origin circuit circ, increment the number of rendezvous
+ * stream counter. This handles every hidden service version. */
+void
+hs_inc_rdv_stream_counter(origin_circuit_t *circ)
+{
+ tor_assert(circ);
+
+ if (circ->rend_data) {
+ circ->rend_data->nr_streams++;
+ } else if (circ->hs_ident) {
+ circ->hs_ident->num_rdv_streams++;
+ } else {
+ /* Should not be called if this circuit is not for hidden service. */
+ tor_assert_nonfatal_unreached();
+ }
+}
+