summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
authorpranomostro <pranomostro@posteo.net>2017-06-03 19:58:18 +0200
committerpranomostro <pranomostro@posteo.net>2017-06-03 19:58:18 +0200
commita5a18a2b84f29595a85bca039df184a454443093 (patch)
treed9b4f19de3b0f27efbb0437d7c17340971e3e2b6 /ratox.c
parentea8e549499a682ec96444a98de3c86fda8a0e7f8 (diff)
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.
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c9
1 files changed, 7 insertions, 2 deletions
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;
}