summaryrefslogtreecommitdiff
path: root/protocols/Tox/libtox/src/toxcore/TCP_connection.c
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-05-25 19:12:13 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-05-25 19:12:13 +0300
commita15f120c4ff2824b71301d5c270288b74bb2aa37 (patch)
treefd3ea82de8d92d7cd2795e931b584d9c4857cb89 /protocols/Tox/libtox/src/toxcore/TCP_connection.c
parent5e0856749a27b186dd23273b238dd176922f6f1a (diff)
libtox: update to 2.2.1
Diffstat (limited to 'protocols/Tox/libtox/src/toxcore/TCP_connection.c')
-rw-r--r--protocols/Tox/libtox/src/toxcore/TCP_connection.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/protocols/Tox/libtox/src/toxcore/TCP_connection.c b/protocols/Tox/libtox/src/toxcore/TCP_connection.c
index c7161a9289..42269ad553 100644
--- a/protocols/Tox/libtox/src/toxcore/TCP_connection.c
+++ b/protocols/Tox/libtox/src/toxcore/TCP_connection.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-3.0-or-later
- * Copyright © 2016-2018 The TokTok team.
+ * Copyright © 2016-2025 The TokTok team.
* Copyright © 2015 Tox project.
*/
@@ -20,6 +20,7 @@
#include "logger.h"
#include "mem.h"
#include "mono_time.h"
+#include "net_profile.h"
#include "network.h"
#include "util.h"
@@ -56,6 +57,9 @@ struct TCP_Connections {
bool onion_status;
uint16_t onion_num_conns;
+
+ /* Network profile for all TCP client packets. */
+ Net_Profile *net_profile;
};
static const TCP_Connection_to empty_tcp_connection_to = {0};
@@ -928,7 +932,8 @@ static int reconnect_tcp_relay_connection(TCP_Connections *tcp_c, int tcp_connec
uint8_t relay_pk[CRYPTO_PUBLIC_KEY_SIZE];
memcpy(relay_pk, tcp_con_public_key(tcp_con->connection), CRYPTO_PUBLIC_KEY_SIZE);
kill_tcp_connection(tcp_con->connection);
- tcp_con->connection = new_tcp_connection(tcp_c->logger, tcp_c->mem, tcp_c->mono_time, tcp_c->rng, tcp_c->ns, &ip_port, relay_pk, tcp_c->self_public_key, tcp_c->self_secret_key, &tcp_c->proxy_info);
+ tcp_con->connection = new_tcp_connection(tcp_c->logger, tcp_c->mem, tcp_c->mono_time, tcp_c->rng, tcp_c->ns, &ip_port, relay_pk, tcp_c->self_public_key, tcp_c->self_secret_key, &tcp_c->proxy_info,
+ tcp_c->net_profile);
if (tcp_con->connection == nullptr) {
kill_tcp_relay_connection(tcp_c, tcp_connections_number);
@@ -1017,7 +1022,7 @@ static int unsleep_tcp_relay_connection(TCP_Connections *tcp_c, int tcp_connecti
tcp_con->connection = new_tcp_connection(
tcp_c->logger, tcp_c->mem, tcp_c->mono_time, tcp_c->rng, tcp_c->ns, &tcp_con->ip_port,
- tcp_con->relay_pk, tcp_c->self_public_key, tcp_c->self_secret_key, &tcp_c->proxy_info);
+ tcp_con->relay_pk, tcp_c->self_public_key, tcp_c->self_secret_key, &tcp_c->proxy_info, tcp_c->net_profile);
if (tcp_con->connection == nullptr) {
kill_tcp_relay_connection(tcp_c, tcp_connections_number);
@@ -1315,7 +1320,7 @@ static int add_tcp_relay_instance(TCP_Connections *tcp_c, const IP_Port *ip_port
tcp_con->connection = new_tcp_connection(
tcp_c->logger, tcp_c->mem, tcp_c->mono_time, tcp_c->rng, tcp_c->ns, &ipp_copy,
- relay_pk, tcp_c->self_public_key, tcp_c->self_secret_key, &tcp_c->proxy_info);
+ relay_pk, tcp_c->self_public_key, tcp_c->self_secret_key, &tcp_c->proxy_info, tcp_c->net_profile);
if (tcp_con->connection == nullptr) {
return -1;
@@ -1591,7 +1596,7 @@ int set_tcp_onion_status(TCP_Connections *tcp_c, bool status)
* Returns NULL on failure.
*/
TCP_Connections *new_tcp_connections(const Logger *logger, const Memory *mem, const Random *rng, const Network *ns,
- Mono_Time *mono_time, const uint8_t *secret_key, const TCP_Proxy_Info *proxy_info)
+ Mono_Time *mono_time, const uint8_t *secret_key, const TCP_Proxy_Info *proxy_info, Net_Profile *tcp_np)
{
assert(logger != nullptr);
assert(mem != nullptr);
@@ -1609,6 +1614,7 @@ TCP_Connections *new_tcp_connections(const Logger *logger, const Memory *mem, co
return nullptr;
}
+ temp->net_profile = tcp_np;
temp->logger = logger;
temp->mem = mem;
temp->rng = rng;
@@ -1727,3 +1733,4 @@ void kill_tcp_connections(TCP_Connections *tcp_c)
mem_delete(tcp_c->mem, tcp_c->connections);
mem_delete(tcp_c->mem, tcp_c);
}
+