From 6311bf8747914a25dfd323c75578fca3e264619f Mon Sep 17 00:00:00 2001 From: irungentoo Date: Wed, 13 Aug 2014 10:19:09 -0400 Subject: [PATCH] If the path is a TCP one, the onion packet is sent with TCP. --- toxcore/onion_client.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index cffcb961..3036df8c 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c @@ -188,9 +188,16 @@ static int send_onion_packet_tcp_udp(const Onion_Client *onion_c, const Onion_Pa return -1; return 0; - } else { + } else if (path->ip_port1.ip.family == TCP_FAMILY) { + uint8_t packet[ONION_MAX_PACKET_SIZE]; + int len = create_onion_packet_tcp(packet, sizeof(packet), path, dest, data, length); - return -1; //TODO: TCP + if (len == -1) + return -1; + + return send_tcp_onion_request(onion_c->c, packet, len); + } else { + return -1; } }