From 6d680274f608130b4d005a43aaa542b6d9a9406e Mon Sep 17 00:00:00 2001 From: irungentoo Date: Mon, 1 Sep 2014 20:26:53 -0400 Subject: [PATCH 1/5] Increased time between ping packets by 1 second. This might make active connections less likely to time out needlessly. --- toxcore/Messenger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index c45eaff9..cead6411 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h @@ -101,7 +101,7 @@ enum { #define FRIENDREQUEST_TIMEOUT 5; /* Interval between the sending of ping packets. */ -#define FRIEND_PING_INTERVAL 5 +#define FRIEND_PING_INTERVAL 6 /* Interval between the sending of tcp relay information */ #define FRIEND_SHARE_RELAYS_INTERVAL (5 * 60) From 5a20f1b0045aa7a18c9abe181e519c5b0e5f2768 Mon Sep 17 00:00:00 2001 From: mouseym Date: Tue, 2 Sep 2014 09:42:23 +0100 Subject: [PATCH 2/5] Linked toxav in the main dependencies section. --- INSTALL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index fe6bf199..608d768b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -53,6 +53,8 @@ pkg install net-im/tox ``` Note, if you install from ports select NaCl for performance, and sodium if you want it to be portable. +**For A/V support, also install the dependences listed in the [libtoxav] (#libtoxav) section.** + You should get and install [libsodium](https://github.com/jedisct1/libsodium): ```bash git clone git://github.com/jedisct1/libsodium.git From 01203a22727ffb33bdeca702381e1d86e00bde2b Mon Sep 17 00:00:00 2001 From: irungentoo Date: Tue, 2 Sep 2014 19:38:44 -0400 Subject: [PATCH 3/5] Expose the tox_add_tcp_relay() function in the public api. Clients can use this function to make Tox connect to user specified TCP relays. --- toxcore/tox.c | 17 ++++++++++------- toxcore/tox.h | 7 +++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/toxcore/tox.c b/toxcore/tox.c index ca87bbe1..d9d88105 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -729,17 +729,20 @@ uint64_t tox_file_data_remaining(const Tox *tox, int32_t friendnumber, uint8_t f /***************END OF FILE SENDING FUNCTIONS******************/ -/* TODO: expose this properly. */ -static int tox_add_tcp_relay(Tox *tox, const char *address, uint8_t ipv6enabled, uint16_t port, - const uint8_t *public_key) +/* Like tox_bootstrap_from_address but for TCP relays only. + * + * return 0 on failure. + * return 1 on success. + */ +int tox_add_tcp_relay(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key) { Messenger *m = tox; IP_Port ip_port_v64; IP *ip_extra = NULL; IP_Port ip_port_v4; - ip_init(&ip_port_v64.ip, ipv6enabled); + ip_init(&ip_port_v64.ip, m->options.ipv6enabled); - if (ipv6enabled) { + if (m->options.ipv6enabled) { /* setup for getting BOTH: an IPv6 AND an IPv4 address */ ip_port_v64.ip.family = AF_UNSPEC; ip_reset(&ip_port_v4.ip); @@ -747,7 +750,7 @@ static int tox_add_tcp_relay(Tox *tox, const char *address, uint8_t ipv6enabled, } if (addr_resolve_or_parse_ip(address, &ip_port_v64.ip, ip_extra)) { - ip_port_v64.port = port; + ip_port_v64.port = htons(port); add_tcp_relay(m->net_crypto, ip_port_v64, public_key); onion_add_path_node(m->onion_c, ip_port_v64, public_key); //TODO: move this return 1; @@ -759,7 +762,7 @@ static int tox_add_tcp_relay(Tox *tox, const char *address, uint8_t ipv6enabled, int tox_bootstrap_from_address(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key) { Messenger *m = tox; - tox_add_tcp_relay(tox, address, m->options.ipv6enabled, htons(port), public_key); + tox_add_tcp_relay(tox, address, port, public_key); return DHT_bootstrap_from_address(m->dht, address, m->options.ipv6enabled, htons(port), public_key); } diff --git a/toxcore/tox.h b/toxcore/tox.h index 550600f9..99ae0a58 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -601,6 +601,13 @@ uint64_t tox_file_data_remaining(const Tox *tox, int32_t friendnumber, uint8_t f */ int tox_bootstrap_from_address(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key); +/* Like tox_bootstrap_from_address but for TCP relays only. + * + * return 0 on failure. + * return 1 on success. + */ +int tox_add_tcp_relay(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key); + /* return 0 if we are not connected to the DHT. * return 1 if we are. */ From 38c411ec3a2b8796e98506eb3ccaa9eb192b430e Mon Sep 17 00:00:00 2001 From: irungentoo Date: Wed, 3 Sep 2014 07:49:51 -0400 Subject: [PATCH 4/5] Fixed iOS possible SIGPIPE issue. Apparently on iOS UDP sockets can SIGPIPE (what the fuck apple?). --- toxcore/network.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toxcore/network.c b/toxcore/network.c index 43030a08..5b267e12 100644 --- a/toxcore/network.c +++ b/toxcore/network.c @@ -518,6 +518,12 @@ Networking_Core *new_networking(IP ip, uint16_t port) int broadcast = 1; setsockopt(temp->sock, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(broadcast)); + /* iOS UDP sockets are weird and apparently can SIGPIPE */ + if (!set_socket_nosigpipe(temp->sock)) { + kill_networking(temp); + return NULL; + } + /* Set socket nonblocking. */ if (!set_socket_nonblock(temp->sock)) { kill_networking(temp); From bb7bde3c0da91c107786711112bf8912a72ecf8f Mon Sep 17 00:00:00 2001 From: irungentoo Date: Wed, 3 Sep 2014 19:14:16 -0400 Subject: [PATCH 5/5] Fixed typo. --- toxcore/tox.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toxcore/tox.h b/toxcore/tox.h index 99ae0a58..c17125a7 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -173,7 +173,7 @@ uint32_t tox_send_action(Tox *tox, int32_t friendnumber, const uint8_t *action, /* Set our nickname. * name must be a string of maximum MAX_NAME_LENGTH length. * length must be at least 1 byte. - * length is the length of name with the NULL terminator. + * length is the length of name. * * return 0 if success. * return -1 if failure.