mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Make channel_get_addr_if_possible() take a const channel_t.
(There is no reason that looking up the address of a channel should ever change it.)
This commit is contained in:
parent
c5db7667d6
commit
a81827d99f
@ -2849,7 +2849,7 @@ channel_get_canonical_remote_descr,(channel_t *chan))
|
|||||||
* doesn't let us do this.
|
* doesn't let us do this.
|
||||||
*/
|
*/
|
||||||
MOCK_IMPL(int,
|
MOCK_IMPL(int,
|
||||||
channel_get_addr_if_possible,(channel_t *chan, tor_addr_t *addr_out))
|
channel_get_addr_if_possible,(const channel_t *chan, tor_addr_t *addr_out))
|
||||||
{
|
{
|
||||||
tor_assert(chan);
|
tor_assert(chan);
|
||||||
tor_assert(addr_out);
|
tor_assert(addr_out);
|
||||||
|
@ -335,7 +335,7 @@ struct channel_t {
|
|||||||
* provided tor_addr_t *, and return 1 if successful or 0 if no address
|
* provided tor_addr_t *, and return 1 if successful or 0 if no address
|
||||||
* available.
|
* available.
|
||||||
*/
|
*/
|
||||||
int (*get_remote_addr)(channel_t *, tor_addr_t *);
|
int (*get_remote_addr)(const channel_t *, tor_addr_t *);
|
||||||
int (*get_transport_name)(channel_t *chan, char **transport_out);
|
int (*get_transport_name)(channel_t *chan, char **transport_out);
|
||||||
|
|
||||||
#define GRD_FLAG_ORIGINAL 1
|
#define GRD_FLAG_ORIGINAL 1
|
||||||
@ -723,7 +723,7 @@ MOCK_DECL(void, channel_dump_statistics, (channel_t *chan, int severity));
|
|||||||
void channel_dump_transport_statistics(channel_t *chan, int severity);
|
void channel_dump_transport_statistics(channel_t *chan, int severity);
|
||||||
const char * channel_get_actual_remote_descr(channel_t *chan);
|
const char * channel_get_actual_remote_descr(channel_t *chan);
|
||||||
const char * channel_get_actual_remote_address(channel_t *chan);
|
const char * channel_get_actual_remote_address(channel_t *chan);
|
||||||
MOCK_DECL(int, channel_get_addr_if_possible, (channel_t *chan,
|
MOCK_DECL(int, channel_get_addr_if_possible, (const channel_t *chan,
|
||||||
tor_addr_t *addr_out));
|
tor_addr_t *addr_out));
|
||||||
MOCK_DECL(const char *, channel_get_canonical_remote_descr,(channel_t *chan));
|
MOCK_DECL(const char *, channel_get_canonical_remote_descr,(channel_t *chan));
|
||||||
int channel_has_queued_writes(channel_t *chan);
|
int channel_has_queued_writes(channel_t *chan);
|
||||||
|
@ -104,7 +104,8 @@ static const char * channel_tls_describe_transport_method(channel_t *chan);
|
|||||||
static void channel_tls_free_method(channel_t *chan);
|
static void channel_tls_free_method(channel_t *chan);
|
||||||
static double channel_tls_get_overhead_estimate_method(channel_t *chan);
|
static double channel_tls_get_overhead_estimate_method(channel_t *chan);
|
||||||
static int
|
static int
|
||||||
channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out);
|
channel_tls_get_remote_addr_method(const channel_t *chan,
|
||||||
|
tor_addr_t *addr_out);
|
||||||
static int
|
static int
|
||||||
channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
|
channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
|
||||||
static const char *
|
static const char *
|
||||||
@ -515,10 +516,10 @@ channel_tls_get_overhead_estimate_method(channel_t *chan)
|
|||||||
* succeeds for this transport).
|
* succeeds for this transport).
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out)
|
channel_tls_get_remote_addr_method(const channel_t *chan, tor_addr_t *addr_out)
|
||||||
{
|
{
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
channel_tls_t *tlschan = BASE_CHAN_TO_TLS(chan);
|
const channel_tls_t *tlschan = BASE_CHAN_TO_TLS((channel_t*) chan);
|
||||||
|
|
||||||
tor_assert(tlschan);
|
tor_assert(tlschan);
|
||||||
tor_assert(addr_out);
|
tor_assert(addr_out);
|
||||||
|
@ -108,7 +108,7 @@ test_dos_conn_creation(void *arg)
|
|||||||
|
|
||||||
/** Helper mock: Place a fake IP addr for this channel in <b>addr_out</b> */
|
/** Helper mock: Place a fake IP addr for this channel in <b>addr_out</b> */
|
||||||
static int
|
static int
|
||||||
mock_channel_get_addr_if_possible(channel_t *chan, tor_addr_t *addr_out)
|
mock_channel_get_addr_if_possible(const channel_t *chan, tor_addr_t *addr_out)
|
||||||
{
|
{
|
||||||
(void)chan;
|
(void)chan;
|
||||||
tt_int_op(AF_INET,OP_EQ, tor_addr_parse(addr_out, "18.0.0.1"));
|
tt_int_op(AF_INET,OP_EQ, tor_addr_parse(addr_out, "18.0.0.1"));
|
||||||
|
Loading…
Reference in New Issue
Block a user