Squashed 'external/toxcore/c-toxcore/' changes from 03e9fbf3703..e740b4e3b2e
e740b4e3b2e feat: Implement Tox network profiler git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: e740b4e3b2e3aa594ab259e2a80153f5eed8fd16
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "logger.h"
|
||||
#include "mem.h"
|
||||
#include "mono_time.h"
|
||||
#include "net_profile.h"
|
||||
#include "network.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -582,7 +583,7 @@ void forwarding_handler(TCP_Client_Connection *con, forwarded_response_cb *forwa
|
||||
TCP_Client_Connection *new_tcp_connection(
|
||||
const Logger *logger, const Memory *mem, const Mono_Time *mono_time, const Random *rng, const Network *ns,
|
||||
const IP_Port *ip_port, const uint8_t *public_key, const uint8_t *self_public_key, const uint8_t *self_secret_key,
|
||||
const TCP_Proxy_Info *proxy_info)
|
||||
const TCP_Proxy_Info *proxy_info, Net_Profile *net_profile)
|
||||
{
|
||||
assert(logger != nullptr);
|
||||
assert(mem != nullptr);
|
||||
@@ -634,6 +635,7 @@ TCP_Client_Connection *new_tcp_connection(
|
||||
temp->con.rng = rng;
|
||||
temp->con.sock = sock;
|
||||
temp->con.ip_port = *ip_port;
|
||||
temp->con.net_profile = net_profile;
|
||||
memcpy(temp->public_key, public_key, CRYPTO_PUBLIC_KEY_SIZE);
|
||||
memcpy(temp->self_public_key, self_public_key, CRYPTO_PUBLIC_KEY_SIZE);
|
||||
encrypt_precompute(temp->public_key, self_secret_key, temp->con.shared_key);
|
||||
@@ -819,6 +821,8 @@ static int handle_tcp_client_packet(const Logger *logger, TCP_Client_Connection
|
||||
return -1;
|
||||
}
|
||||
|
||||
netprof_record_packet(conn->con.net_profile, data[0], length, PACKET_DIRECTION_RECV);
|
||||
|
||||
switch (data[0]) {
|
||||
case TCP_PACKET_ROUTING_RESPONSE:
|
||||
return handle_tcp_client_routing_response(conn, data, length);
|
||||
|
||||
Reference in New Issue
Block a user