diff options
-rw-r--r-- | toxcore/Messenger.c | 14 | ||||
-rw-r--r-- | toxcore/tox.c | 25 |
2 files changed, 14 insertions, 25 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 359708ee..20213016 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -2216,6 +2216,11 @@ void do_friends(Messenger *m) | |||
2216 | m->friendlist[i].user_istyping_sent = 1; | 2216 | m->friendlist[i].user_istyping_sent = 1; |
2217 | } | 2217 | } |
2218 | 2218 | ||
2219 | if (m->friendlist[i].tcp_server_sent == 0) { | ||
2220 | if (send_user_tcp_server(m, i)) | ||
2221 | m->friendlist[i].tcp_server_sent = 1; | ||
2222 | } | ||
2223 | |||
2219 | check_friend_tcp_udp(m, i); | 2224 | check_friend_tcp_udp(m, i); |
2220 | do_receipts(m, i); | 2225 | do_receipts(m, i); |
2221 | do_reqchunk_filecb(m, i); | 2226 | do_reqchunk_filecb(m, i); |
@@ -2286,6 +2291,15 @@ void do_messenger(Messenger *m) | |||
2286 | for (i = 0; i < NUM_SAVED_TCP_RELAYS; ++i) { | 2291 | for (i = 0; i < NUM_SAVED_TCP_RELAYS; ++i) { |
2287 | add_tcp_relay(m->net_crypto, m->loaded_relays[i].ip_port, m->loaded_relays[i].public_key); | 2292 | add_tcp_relay(m->net_crypto, m->loaded_relays[i].ip_port, m->loaded_relays[i].public_key); |
2288 | } | 2293 | } |
2294 | |||
2295 | if (m->tcp_server) { | ||
2296 | /* Add self tcp server. */ | ||
2297 | IP_Port local_ip_port; | ||
2298 | local_ip_port.port = m->options.tcp_server_port; | ||
2299 | local_ip_port.ip.family = AF_INET; | ||
2300 | local_ip_port.ip.ip4.uint32 = INADDR_LOOPBACK; | ||
2301 | add_tcp_relay(m->net_crypto, local_ip_port, m->tcp_server->public_key); | ||
2302 | } | ||
2289 | } | 2303 | } |
2290 | 2304 | ||
2291 | unix_time_update(); | 2305 | unix_time_update(); |
diff --git a/toxcore/tox.c b/toxcore/tox.c index 4f3613ee..de615768 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -239,31 +239,6 @@ void tox_get_savedata(const Tox *tox, uint8_t *data) | |||
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | static int address_to_ip(Messenger *m, const char *address, IP_Port *ip_port, IP_Port *ip_port_v4) | ||
243 | { | ||
244 | if (!addr_parse_ip(address, &ip_port->ip)) { | ||
245 | if (m->options.udp_disabled) { /* Disable DNS when udp is disabled. */ | ||
246 | return -1; | ||
247 | } | ||
248 | |||
249 | IP *ip_extra = NULL; | ||
250 | ip_init(&ip_port->ip, m->options.ipv6enabled); | ||
251 | |||
252 | if (m->options.ipv6enabled && ip_port_v4) { | ||
253 | /* setup for getting BOTH: an IPv6 AND an IPv4 address */ | ||
254 | ip_port->ip.family = AF_UNSPEC; | ||
255 | ip_reset(&ip_port_v4->ip); | ||
256 | ip_extra = &ip_port_v4->ip; | ||
257 | } | ||
258 | |||
259 | if (!addr_resolve(address, &ip_port->ip, ip_extra)) { | ||
260 | return -1; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | bool tox_bootstrap(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key, TOX_ERR_BOOTSTRAP *error) | 242 | bool tox_bootstrap(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key, TOX_ERR_BOOTSTRAP *error) |
268 | { | 243 | { |
269 | if (!address || !public_key) { | 244 | if (!address || !public_key) { |