diff options
author | George Kadianakis <desnacked@riseup.net> | 2012-01-25 21:23:46 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2012-07-03 21:26:03 +0300 |
commit | d11b772a6c621d7011eed20cd58383c6f1ac0b54 (patch) | |
tree | 652fe06e64d794b646639550e2db55812675f663 /src/or/transports.c | |
parent | 6173d36340096fc3e188e6cc886c345981e0f303 (diff) | |
download | tor-d11b772a6c621d7011eed20cd58383c6f1ac0b54.tar tor-d11b772a6c621d7011eed20cd58383c6f1ac0b54.tar.gz |
Introduce a transport_t deep copy function.
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 4f67a4633..566cd9324 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 * |