Skip to content

Commit

Permalink
try to send a rejoin packet whenever we freeze a peer
Browse files Browse the repository at this point in the history
  • Loading branch information
zugz committed Sep 20, 2018
1 parent ce72c9d commit 1c43cd0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions toxcore/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@ static int delpeer(Group_Chats *g_c, uint32_t groupnumber, int peer_index, void
return 0;
}

static bool try_send_rejoin(Group_Chats *g_c, uint32_t groupnumber, const uint8_t *real_pk);

static int freeze_peer(Group_Chats *g_c, uint32_t groupnumber, int peer_index, void *userdata)
{
Group_c *g = get_group_c(g_c, groupnumber);
Expand All @@ -710,6 +712,8 @@ static int freeze_peer(Group_Chats *g_c, uint32_t groupnumber, int peer_index, v
return -1;
}

try_send_rejoin(g_c, groupnumber, g->group[peer_index].real_pk);

Group_Peer *temp = (Group_Peer *)realloc(g->frozen, sizeof(Group_Peer) * (g->numfrozen + 1));

if (temp == nullptr) {
Expand Down Expand Up @@ -855,8 +859,6 @@ static void set_conns_status_groups(Group_Chats *g_c, int friendcon_id, uint8_t
}
}

static bool try_send_rejoin(Group_Chats *g_c, uint32_t groupnumber, const uint8_t *real_pk);

static void rejoin_frozen_friend(Group_Chats *g_c, int friendcon_id)
{
uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE];
Expand Down Expand Up @@ -2844,7 +2846,6 @@ static int groupchat_freeze_timedout(Group_Chats *g_c, uint32_t groupnumber, voi
}

if (mono_time_is_timeout(g_c->mono_time, g->group[i].last_active, GROUP_PING_INTERVAL * 3)) {
try_send_rejoin(g_c, groupnumber, g->group[i].real_pk);
freeze_peer(g_c, groupnumber, i, userdata);
}
}
Expand Down

0 comments on commit 1c43cd0

Please sign in to comment.