summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2018-09-19 20:07:02 +0200
committerzugz (tox) <mbays+tox@sdf.org>2018-09-20 22:30:28 +0200
commite43b2eadc003179c0f14e948ce6293bffde34188 (patch)
tree39b9089ca64149b65d2906d10bc6e54b78de2e9c /toxcore
parentd3d5b701cb940e5f6c7cb2af199428fc8224e665 (diff)
Send rejoin packets on conference disconnection
We were mistakenly not making a rejoin attempt on freezing connections due to all closest connections going down. This fixes that, and tweaks the test. I've still only done tens rather than hundreds of tests, but I'm fairly confident that the conference test now consistently passes.
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/group.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/toxcore/group.c b/toxcore/group.c
index c019c0eb..5feb483b 100644
--- a/toxcore/group.c
+++ b/toxcore/group.c
@@ -702,6 +702,8 @@ static int delpeer(Group_Chats *g_c, uint32_t groupnumber, int peer_index, void
702 return 0; 702 return 0;
703} 703}
704 704
705static bool try_send_rejoin(Group_Chats *g_c, uint32_t groupnumber, const uint8_t *real_pk);
706
705static int freeze_peer(Group_Chats *g_c, uint32_t groupnumber, int peer_index, void *userdata) 707static int freeze_peer(Group_Chats *g_c, uint32_t groupnumber, int peer_index, void *userdata)
706{ 708{
707 Group_c *g = get_group_c(g_c, groupnumber); 709 Group_c *g = get_group_c(g_c, groupnumber);
@@ -710,6 +712,8 @@ static int freeze_peer(Group_Chats *g_c, uint32_t groupnumber, int peer_index, v
710 return -1; 712 return -1;
711 } 713 }
712 714
715 try_send_rejoin(g_c, groupnumber, g->group[peer_index].real_pk);
716
713 Group_Peer *temp = (Group_Peer *)realloc(g->frozen, sizeof(Group_Peer) * (g->numfrozen + 1)); 717 Group_Peer *temp = (Group_Peer *)realloc(g->frozen, sizeof(Group_Peer) * (g->numfrozen + 1));
714 718
715 if (temp == nullptr) { 719 if (temp == nullptr) {
@@ -855,8 +859,6 @@ static void set_conns_status_groups(Group_Chats *g_c, int friendcon_id, uint8_t
855 } 859 }
856} 860}
857 861
858static bool try_send_rejoin(Group_Chats *g_c, uint32_t groupnumber, const uint8_t *real_pk);
859
860static void rejoin_frozen_friend(Group_Chats *g_c, int friendcon_id) 862static void rejoin_frozen_friend(Group_Chats *g_c, int friendcon_id)
861{ 863{
862 uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE]; 864 uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE];
@@ -2844,7 +2846,6 @@ static int groupchat_freeze_timedout(Group_Chats *g_c, uint32_t groupnumber, voi
2844 } 2846 }
2845 2847
2846 if (mono_time_is_timeout(g_c->mono_time, g->group[i].last_active, GROUP_PING_INTERVAL * 3)) { 2848 if (mono_time_is_timeout(g_c->mono_time, g->group[i].last_active, GROUP_PING_INTERVAL * 3)) {
2847 try_send_rejoin(g_c, groupnumber, g->group[i].real_pk);
2848 freeze_peer(g_c, groupnumber, i, userdata); 2849 freeze_peer(g_c, groupnumber, i, userdata);
2849 } 2850 }
2850 } 2851 }