mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed issue where callbacks were not set for accepted connection.
This commit is contained in:
parent
1580a5c696
commit
87cec79206
|
@ -1738,6 +1738,9 @@ static void LANdiscovery(Messenger *m)
|
|||
}
|
||||
}
|
||||
|
||||
static int handle_status(void *object, int i, uint8_t status);
|
||||
static int handle_packet(void *object, int i, uint8_t *temp, uint16_t len);
|
||||
|
||||
static int handle_new_connections(void *object, New_Connection *n_c)
|
||||
{
|
||||
Messenger *m = object;
|
||||
|
@ -1747,8 +1750,12 @@ static int handle_new_connections(void *object, New_Connection *n_c)
|
|||
if (m->friendlist[friend_id].crypt_connection_id != -1)
|
||||
return -1;
|
||||
|
||||
m->friendlist[friend_id].crypt_connection_id = accept_crypto_connection(m->net_crypto, n_c);
|
||||
int id = accept_crypto_connection(m->net_crypto, n_c);
|
||||
connection_status_handler(m->net_crypto, id, &handle_status, m, friend_id);
|
||||
connection_data_handler(m->net_crypto, id, &handle_packet, m, friend_id);
|
||||
m->friendlist[friend_id].crypt_connection_id = id;
|
||||
set_friend_status(m, friend_id, FRIEND_CONFIRMED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
|
|
@ -1527,7 +1527,7 @@ static void send_crypto_packets(Net_Crypto *c)
|
|||
send_temp_packet(c, i);
|
||||
}
|
||||
|
||||
if (conn->status >= CRYPTO_CONN_NOT_CONFIRMED
|
||||
if ((conn->status == CRYPTO_CONN_NOT_CONFIRMED || conn->status == CRYPTO_CONN_ESTABLISHED)
|
||||
&& (CRYPTO_SEND_PACKET_INTERVAL + conn->last_request_packet_sent) < temp_time) {
|
||||
if (send_request_packet(c, i) == 0) {
|
||||
conn->last_request_packet_sent = temp_time;
|
||||
|
|
Loading…
Reference in New Issue
Block a user