From a5a18a2b84f29595a85bca039df184a454443093 Mon Sep 17 00:00:00 2001 From: pranomostro Date: Sat, 3 Jun 2017 19:58:18 +0200 Subject: Add connecting to tcp relays by default. I'm currently staying in India, and strangely enough ratox could not connect using tox_bootstrap(). It would just continue attempting to connect until the end of time. Using tox_add_tcp_relay() additionally fixes this isssue. It is also the strategy utox uses: https://github.com/uTox/uTox/blob/49bc764d23a02ab8286ef6f2085e8e592bccde1e/src/tox.c#L137 Also, nodes.h needed to be regenerated for using tcp ports and relays. --- ratox.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ratox.c') diff --git a/ratox.c b/ratox.c index 16653b8..dbd271f 100644 --- a/ratox.c +++ b/ratox.c @@ -50,7 +50,8 @@ const char *callerr[] = { struct node { char *addr4; char *addr6; - uint16_t port; + uint16_t udp_port; + uint16_t tcp_port; char *idstr; }; @@ -1465,9 +1466,13 @@ toxconnect(void) if (ipv6 && !n->addr6) continue; str2id(n->idstr, id); - r = tox_bootstrap(tox, ipv6 ? n->addr6 : n->addr4, n->port, id, NULL); + r = tox_bootstrap(tox, ipv6 ? n->addr6 : n->addr4, n->udp_port, id, NULL); if (!r) weprintf("Bootstrap failed for %s\n", ipv6 ? n->addr6 : n->addr4); + str2id(n->idstr, id); + r += tox_add_tcp_relay(tox, ipv6 ? n->addr6 : n->addr4, n->tcp_port, id, NULL); + if (!r) + weprintf("Adding a relay failed for %s\n", ipv6 ? n->addr6 : n->addr4); } return 0; } -- cgit v1.2.3