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 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) 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); diff --git a/toxcore/tox.c b/toxcore/tox.c index 9bdbf8da..600eafa6 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 e370b499..e900cc7f 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. @@ -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. */