mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Send groupchat ips like DHT ones.
This commit is contained in:
parent
a4968bdbc5
commit
48c50b5cef
|
@ -848,15 +848,18 @@ static int sendnodes(DHT *dht, IP_Port ip_port, uint8_t *public_key, uint8_t *cl
|
|||
return sendpacket(dht->c->lossless_udp->net, ip_port, data, 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + len);
|
||||
}
|
||||
|
||||
static void to_net_family(IP *ip)
|
||||
void to_net_family(IP *ip)
|
||||
{
|
||||
ip->padding[0] = 0;
|
||||
ip->padding[1] = 0;
|
||||
ip->padding[2] = 0;
|
||||
if (ip->family == AF_INET)
|
||||
ip->family = TOX_AF_INET;
|
||||
else if (ip->family == AF_INET6)
|
||||
ip->family = TOX_AF_INET6;
|
||||
}
|
||||
|
||||
static void to_host_family(IP *ip)
|
||||
void to_host_family(IP *ip)
|
||||
{
|
||||
if (ip->family == TOX_AF_INET)
|
||||
ip->family = AF_INET;
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
#define TOX_AF_INET 2
|
||||
#define TOX_AF_INET6 10
|
||||
|
||||
/* Functions to transfer ips safely across wire. */
|
||||
void to_net_family(IP *ip);
|
||||
void to_host_family(IP *ip);
|
||||
|
||||
typedef struct {
|
||||
IP_Port ip_port;
|
||||
uint64_t timestamp;
|
||||
|
|
|
@ -354,6 +354,7 @@ static int send_sendnodes(Group_Chat *chat, IP_Port ip_port, int peernum, uint64
|
|||
if (!is_timeout(chat->close[i].last_recv, BAD_GROUPNODE_TIMEOUT)) {
|
||||
id_copy(contents.nodes[j].client_id, chat->close[i].client_id);
|
||||
contents.nodes[j].ip_port = chat->close[i].ip_port;
|
||||
to_net_family(&contents.nodes[j].ip_port.ip);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
@ -417,6 +418,7 @@ static int handle_sendnodes(Group_Chat *chat, IP_Port source, int peernum, uint8
|
|||
if (peern == -1)
|
||||
continue;
|
||||
|
||||
to_host_family(&contents.nodes[i].ip_port.ip);
|
||||
send_getnodes(chat, contents.nodes[i].ip_port, peern);
|
||||
|
||||
if (chat->assoc) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user