summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toxcore/Messenger.c7
-rw-r--r--toxcore/onion_client.c1
2 files changed, 8 insertions, 0 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 2772d6d0..f4e497d0 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -1662,6 +1662,12 @@ int custom_user_packet_registerhandler(Messenger *m, int friendnumber, uint8_t b
1662 1662
1663int send_custom_user_packet(Messenger *m, int friendnumber, uint8_t *data, uint32_t length) 1663int send_custom_user_packet(Messenger *m, int friendnumber, uint8_t *data, uint32_t length)
1664{ 1664{
1665 if (friend_not_valid(m, friendnumber))
1666 return -1;
1667
1668 if (m->friendlist[friendnumber].status != FRIEND_ONLINE)
1669 return -1;
1670
1665 IP_Port ip_port = get_friend_ipport(m, friendnumber); 1671 IP_Port ip_port = get_friend_ipport(m, friendnumber);
1666 1672
1667 if (ip_port.port == 0) 1673 if (ip_port.port == 0)
@@ -2026,6 +2032,7 @@ void do_friends(Messenger *m)
2026 break; 2032 break;
2027 2033
2028 group_newpeer(m->chats[groupnum], data + crypto_box_PUBLICKEYBYTES); 2034 group_newpeer(m->chats[groupnum], data + crypto_box_PUBLICKEYBYTES);
2035 /* This is just there to speedup joining. */
2029 chat_bootstrap(m->chats[groupnum], get_friend_ipport(m, i), data + crypto_box_PUBLICKEYBYTES); 2036 chat_bootstrap(m->chats[groupnum], get_friend_ipport(m, i), data + crypto_box_PUBLICKEYBYTES);
2030 break; 2037 break;
2031 } 2038 }
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index 8c0e426a..db6bd39a 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -528,6 +528,7 @@ int send_onion_data(Onion_Client *onion_c, int friend_num, uint8_t *data, uint32
528 continue; 528 continue;
529 529
530 ++num_nodes; 530 ++num_nodes;
531
531 if (list_nodes[i].is_stored) { 532 if (list_nodes[i].is_stored) {
532 if (random_path(onion_c->dht, &onion_c->friends_list[friend_num].onion_paths, ~0, &path[num_good]) == -1) 533 if (random_path(onion_c->dht, &onion_c->friends_list[friend_num].onion_paths, ~0, &path[num_good]) == -1)
533 continue; 534 continue;