[tor-commits] [tor/master] Remove connection_edge_streams_are_compatible

nickm at torproject.org nickm at torproject.org
Mon Aug 8 13:45:17 UTC 2011


commit cb24a06a3e1825001ea97f1a19249dade2f68215
Author: Robert Ransom <rransom.8774 at gmail.com>
Date:   Sat Aug 6 13:44:28 2011 -0700

    Remove connection_edge_streams_are_compatible
    
    It's dead code (not used anywhere by the current proposal 171 algorithm).
---
 src/or/connection_edge.c |   52 ----------------------------------------------
 src/or/connection_edge.h |    2 -
 2 files changed, 0 insertions(+), 54 deletions(-)

diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 37a695c..7dd6ee0 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -3346,58 +3346,6 @@ memeq_opt(const char *a, size_t alen, const char *b, size_t blen)
   }
 }
 
-/** Return true iff <b>a</b> and <b>b</b> have isolation rules and fields that
- * make it permissible to put them on the same circuit.*/
-int
-connection_edge_streams_are_compatible(const edge_connection_t *a,
-                                       const edge_connection_t *b)
-{
-  const uint8_t iso = a->isolation_flags | b->isolation_flags;
-  const socks_request_t *a_sr = a->socks_request;
-  const socks_request_t *b_sr = b->socks_request;
-
-  if (! a->original_dest_address) {
-    log_warn(LD_BUG, "Reached connection_edge_streams_are_compatible without "
-             "having set a->original_dest_address");
-    ((edge_connection_t*)a)->original_dest_address =
-      tor_strdup(a->socks_request->address);
-  }
-  if (! b->original_dest_address) {
-    log_warn(LD_BUG, "Reached connection_edge_streams_are_compatible without "
-             "having set b->original_dest_address");
-    ((edge_connection_t*)b)->original_dest_address =
-      tor_strdup(a->socks_request->address);
-  }
-
-  if (iso & ISO_STREAM)
-    return 0;
-
-  if ((iso & ISO_DESTPORT) && a->socks_request->port != b->socks_request->port)
-    return 0;
-  if ((iso & ISO_DESTADDR) &&
-      strcasecmp(a->original_dest_address, b->original_dest_address))
-    return 0;
-  if ((iso & ISO_SOCKSAUTH) &&
-      (! memeq_opt(a_sr->username, a_sr->usernamelen,
-                   b_sr->username, b_sr->usernamelen) ||
-       ! memeq_opt(a_sr->password, a_sr->passwordlen,
-                   b_sr->password, b_sr->passwordlen)))
-    return 0;
-  if ((iso & ISO_CLIENTPROTO) &&
-      (a->socks_request->listener_type != b->socks_request->listener_type ||
-       a->socks_request->socks_version != b->socks_request->socks_version))
-    return 0;
-  if ((iso & ISO_CLIENTADDR) &&
-      !tor_addr_eq(&TO_CONN(a)->addr, &TO_CONN(b)->addr))
-    return 0;
-  if ((iso & ISO_SESSIONGRP) && a->session_group != b->session_group)
-    return 0;
-  if ((iso & ISO_NYM_EPOCH) && a->nym_epoch != b->nym_epoch)
-    return 0;
-
-  return 1;
-}
-
 /**
  * Return true iff none of the isolation flags and fields in <b>conn</b>
  * should prevent it from being attached to <b>circ</b>.
diff --git a/src/or/connection_edge.h b/src/or/connection_edge.h
index 85293a0..36aead1 100644
--- a/src/or/connection_edge.h
+++ b/src/or/connection_edge.h
@@ -105,8 +105,6 @@ hostname_type_t parse_extended_hostname(char *address, int allowdotexit);
 int get_pf_socket(void);
 #endif
 
-int connection_edge_streams_are_compatible(const edge_connection_t *a,
-                                           const edge_connection_t *b);
 int connection_edge_compatible_with_circuit(const edge_connection_t *conn,
                                             const origin_circuit_t *circ);
 int connection_edge_update_circuit_isolation(const edge_connection_t *conn,



More information about the tor-commits mailing list