diff options
author | irungentoo <irungentoo@gmail.com> | 2015-04-21 15:30:41 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-04-21 15:30:41 -0400 |
commit | e1a98987ffeea04dd075be760af7621824fdc30a (patch) | |
tree | c6482a9e3e8404c41ad5ab2a4e166d4e21419a45 /toxcore/TCP_connection.h | |
parent | 0a0ed452026129fc9055c35ab75cfadab6f0dc06 (diff) |
Only allocate some TCP connections for onion use when needed.
Added a function to enable and disable TCP onion connections.
Diffstat (limited to 'toxcore/TCP_connection.h')
-rw-r--r-- | toxcore/TCP_connection.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/toxcore/TCP_connection.h b/toxcore/TCP_connection.h index c3cf4889..3f7b616d 100644 --- a/toxcore/TCP_connection.h +++ b/toxcore/TCP_connection.h | |||
@@ -99,6 +99,7 @@ typedef struct { | |||
99 | 99 | ||
100 | TCP_Proxy_Info proxy_info; | 100 | TCP_Proxy_Info proxy_info; |
101 | 101 | ||
102 | _Bool onion_status; | ||
102 | uint16_t onion_num_conns; | 103 | uint16_t onion_num_conns; |
103 | } TCP_Connections; | 104 | } TCP_Connections; |
104 | 105 | ||
@@ -127,6 +128,15 @@ int get_random_tcp_onion_conn_number(TCP_Connections *tcp_c); | |||
127 | int tcp_send_onion_request(TCP_Connections *tcp_c, unsigned int tcp_connections_number, const uint8_t *data, | 128 | int tcp_send_onion_request(TCP_Connections *tcp_c, unsigned int tcp_connections_number, const uint8_t *data, |
128 | uint16_t length); | 129 | uint16_t length); |
129 | 130 | ||
131 | /* Set if we want TCP_connection to allocate some connection for onion use. | ||
132 | * | ||
133 | * If status is 1, allocate some connections. if status is 0, don't. | ||
134 | * | ||
135 | * return 0 on success. | ||
136 | * return -1 on failure. | ||
137 | */ | ||
138 | int set_tcp_onion_status(TCP_Connections *tcp_c, _Bool status); | ||
139 | |||
130 | /* Send an oob packet via the TCP relay corresponding to tcp_connections_number. | 140 | /* Send an oob packet via the TCP relay corresponding to tcp_connections_number. |
131 | * | 141 | * |
132 | * return 0 on success. | 142 | * return 0 on success. |