mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Connect to own TCP server if hosting one.
Removed useless code.
This commit is contained in:
parent
478552d338
commit
53c6b26a7e
|
@ -2216,6 +2216,11 @@ void do_friends(Messenger *m)
|
|||
m->friendlist[i].user_istyping_sent = 1;
|
||||
}
|
||||
|
||||
if (m->friendlist[i].tcp_server_sent == 0) {
|
||||
if (send_user_tcp_server(m, i))
|
||||
m->friendlist[i].tcp_server_sent = 1;
|
||||
}
|
||||
|
||||
check_friend_tcp_udp(m, i);
|
||||
do_receipts(m, i);
|
||||
do_reqchunk_filecb(m, i);
|
||||
|
@ -2286,6 +2291,15 @@ void do_messenger(Messenger *m)
|
|||
for (i = 0; i < NUM_SAVED_TCP_RELAYS; ++i) {
|
||||
add_tcp_relay(m->net_crypto, m->loaded_relays[i].ip_port, m->loaded_relays[i].public_key);
|
||||
}
|
||||
|
||||
if (m->tcp_server) {
|
||||
/* Add self tcp server. */
|
||||
IP_Port local_ip_port;
|
||||
local_ip_port.port = m->options.tcp_server_port;
|
||||
local_ip_port.ip.family = AF_INET;
|
||||
local_ip_port.ip.ip4.uint32 = INADDR_LOOPBACK;
|
||||
add_tcp_relay(m->net_crypto, local_ip_port, m->tcp_server->public_key);
|
||||
}
|
||||
}
|
||||
|
||||
unix_time_update();
|
||||
|
|
|
@ -239,31 +239,6 @@ void tox_get_savedata(const Tox *tox, uint8_t *data)
|
|||
}
|
||||
}
|
||||
|
||||
static int address_to_ip(Messenger *m, const char *address, IP_Port *ip_port, IP_Port *ip_port_v4)
|
||||
{
|
||||
if (!addr_parse_ip(address, &ip_port->ip)) {
|
||||
if (m->options.udp_disabled) { /* Disable DNS when udp is disabled. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
IP *ip_extra = NULL;
|
||||
ip_init(&ip_port->ip, m->options.ipv6enabled);
|
||||
|
||||
if (m->options.ipv6enabled && ip_port_v4) {
|
||||
/* setup for getting BOTH: an IPv6 AND an IPv4 address */
|
||||
ip_port->ip.family = AF_UNSPEC;
|
||||
ip_reset(&ip_port_v4->ip);
|
||||
ip_extra = &ip_port_v4->ip;
|
||||
}
|
||||
|
||||
if (!addr_resolve(address, &ip_port->ip, ip_extra)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool tox_bootstrap(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key, TOX_ERR_BOOTSTRAP *error)
|
||||
{
|
||||
if (!address || !public_key) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user