diff options
Diffstat (limited to 'src/or/transports.c')
-rw-r--r-- | src/or/transports.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/transports.c b/src/or/transports.c index 4f67a46339..566cd93249 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -195,6 +195,25 @@ transport_free(transport_t *transport) tor_free(transport); } +/** Return a deep copy of <b>transport</b>. */ +static transport_t * +transport_copy(const transport_t *transport) +{ + transport_t *new_transport = NULL; + + tor_assert(transport); + + new_transport = tor_malloc_zero(sizeof(transport_t)); + + new_transport->socks_version = transport->socks_version; + new_transport->name = tor_strdup(transport->name); + tor_addr_copy(&new_transport->addr, &transport->addr); + new_transport->port = transport->port; + new_transport->marked_for_removal = transport->marked_for_removal; + + return new_transport; +} + /** Returns the transport in our transport list that has the name <b>name</b>. * Else returns NULL. */ transport_t * |