summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r--toxcore/Messenger.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index fcee455c..3cb0fbb6 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -2010,7 +2010,8 @@ Messenger *new_messenger(Messenger_Options *options, unsigned int *error)
2010 } 2010 }
2011 2011
2012 if (options->tcp_server_port) { 2012 if (options->tcp_server_port) {
2013 m->tcp_server = new_TCP_server(options->ipv6enabled, 1, &options->tcp_server_port, m->dht->self_secret_key, m->onion); 2013 m->tcp_server = new_TCP_server(options->ipv6enabled, 1, &options->tcp_server_port, dht_get_self_secret_key(m->dht),
2014 m->onion);
2014 2015
2015 if (m->tcp_server == NULL) { 2016 if (m->tcp_server == NULL) {
2016 kill_friend_connections(m->fr_c); 2017 kill_friend_connections(m->fr_c);
@@ -2571,8 +2572,8 @@ void do_messenger(Messenger *m, void *userdata)
2571 uint32_t client, last_pinged; 2572 uint32_t client, last_pinged;
2572 2573
2573 for (client = 0; client < LCLIENT_LIST; client++) { 2574 for (client = 0; client < LCLIENT_LIST; client++) {
2574 Client_data *cptr = &m->dht->close_clientlist[client]; 2575 const Client_data *cptr = dht_get_close_client(m->dht, client);
2575 IPPTsPng *assoc = NULL; 2576 const IPPTsPng *assoc = NULL;
2576 uint32_t a; 2577 uint32_t a;
2577 2578
2578 for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) { 2579 for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) {
@@ -2597,7 +2598,7 @@ void do_messenger(Messenger *m, void *userdata)
2597 uint32_t friend_idx, dhtfriend; 2598 uint32_t friend_idx, dhtfriend;
2598 2599
2599 /* dht contains additional "friends" (requests) */ 2600 /* dht contains additional "friends" (requests) */
2600 uint32_t num_dhtfriends = m->dht->num_friends; 2601 uint32_t num_dhtfriends = dht_get_num_friends(m->dht);
2601 VLA(int32_t, m2dht, num_dhtfriends); 2602 VLA(int32_t, m2dht, num_dhtfriends);
2602 VLA(int32_t, dht2m, num_dhtfriends); 2603 VLA(int32_t, dht2m, num_dhtfriends);
2603 2604
@@ -2609,8 +2610,8 @@ void do_messenger(Messenger *m, void *userdata)
2609 continue; 2610 continue;
2610 } 2611 }
2611 2612
2612 for (dhtfriend = 0; dhtfriend < m->dht->num_friends; dhtfriend++) { 2613 for (dhtfriend = 0; dhtfriend < dht_get_num_friends(m->dht); dhtfriend++) {
2613 if (id_equal(m->friendlist[friend_idx].real_pk, m->dht->friends_list[dhtfriend].public_key)) { 2614 if (id_equal(m->friendlist[friend_idx].real_pk, dht_get_friend_public_key(m->dht, dhtfriend))) {
2614 m2dht[friend_idx] = dhtfriend; 2615 m2dht[friend_idx] = dhtfriend;
2615 break; 2616 break;
2616 } 2617 }
@@ -2623,8 +2624,8 @@ void do_messenger(Messenger *m, void *userdata)
2623 } 2624 }
2624 } 2625 }
2625 2626
2626 if (m->numfriends != m->dht->num_friends) { 2627 if (m->numfriends != dht_get_num_friends(m->dht)) {
2627 LOGGER_TRACE(m->log, "Friend num in DHT %u != friend num in msger %u\n", m->dht->num_friends, m->numfriends); 2628 LOGGER_TRACE(m->log, "Friend num in DHT %u != friend num in msger %u\n", dht_get_num_friends(m->dht), m->numfriends);
2628 } 2629 }
2629 2630
2630 Friend *msgfptr; 2631 Friend *msgfptr;
@@ -2637,7 +2638,7 @@ void do_messenger(Messenger *m, void *userdata)
2637 msgfptr = NULL; 2638 msgfptr = NULL;
2638 } 2639 }
2639 2640
2640 dhtfptr = &m->dht->friends_list[friend_idx]; 2641 dhtfptr = dht_get_friend(m->dht, friend_idx);
2641 2642
2642 if (msgfptr) { 2643 if (msgfptr) {
2643 char id_str[IDSTRING_LEN]; 2644 char id_str[IDSTRING_LEN];