commit 4ca5efe9651cccaaa0e0f2272dae57cd024fea52 Author: Zack Weinberg zackw@cmu.edu Date: Mon Feb 27 16:46:47 2012 -0800
Remove ->cfg pointer from the generic conn_t. --- src/connections.h | 1 - src/protocol.h | 3 +-- src/protocol/chop.cc | 4 +++- src/protocol/null.cc | 1 + 4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/connections.h b/src/connections.h index b0cac55..103e246 100644 --- a/src/connections.h +++ b/src/connections.h @@ -14,7 +14,6 @@ Connections are associated with circuits (and thus with upstream socket-level connections) as quickly as possible. */ struct conn_t { - config_t *cfg; const char *peername; struct bufferevent *buffer; unsigned int serial; diff --git a/src/protocol.h b/src/protocol.h index d28bf19..98ad39c 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -61,8 +61,7 @@ struct config_t /** Return an extended 'conn_t' object for a new socket using this configuration. The 'index' argument is equal to the 'N' argument to get_listen_addrs or get_target_addrs that retrieved - the address to which the socket is bound. Must fill in the - 'cfg' field of the generic structure. */ + the address to which the socket is bound. */ virtual conn_t *conn_create(size_t index) = 0; };
diff --git a/src/protocol/chop.cc b/src/protocol/chop.cc index 536481c..db284cb 100644 --- a/src/protocol/chop.cc +++ b/src/protocol/chop.cc @@ -72,11 +72,13 @@ static const uint8_t s2c_key[] = /* Connections and circuits */
namespace { + struct chop_config_t; struct chop_circuit_t; typedef unordered_map<uint64_t, chop_circuit_t *> chop_circuit_table;
struct chop_conn_t : conn_t { + chop_config_t *cfg; chop_circuit_t *upstream; steg_t *steg; struct evbuffer *recv_pending; @@ -783,7 +785,7 @@ chop_push_to_upstream(chop_circuit_t *ckt) static int chop_find_or_make_circuit(chop_conn_t *conn, uint64_t circuit_id) { - chop_config_t *cfg = static_cast<chop_config_t *>(conn->cfg); + chop_config_t *cfg = conn->cfg; chop_circuit_table::value_type in(circuit_id, 0); std::pair<chop_circuit_table::iterator, bool> out = cfg->circuits.insert(in); chop_circuit_t *ck; diff --git a/src/protocol/null.cc b/src/protocol/null.cc index be89821..6b471a0 100644 --- a/src/protocol/null.cc +++ b/src/protocol/null.cc @@ -21,6 +21,7 @@ namespace {
struct null_conn_t : conn_t { + null_config_t *cfg; null_circuit_t *upstream;
CONN_DECLARE_METHODS(null);
tor-commits@lists.torproject.org