summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2019-01-05 22:02:45 +0100
committerzugz (tox) <mbays+tox@sdf.org>2019-01-07 01:11:12 +0100
commit86935beb2fc04f4cefc47b77c85fb1ab02f0e05d (patch)
tree87253e041034be4ef565839cc080714d6fb0b9fb /toxcore
parent6bc12232ac819dcfec1b12846dd66bf00cb09288 (diff)
Avoid sending group messages to a peer before we have its group number
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/group.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/toxcore/group.c b/toxcore/group.c
index dfa821a4..d0609b1a 100644
--- a/toxcore/group.c
+++ b/toxcore/group.c
@@ -1041,7 +1041,10 @@ static void remove_conn_reason(Group_Chats *g_c, uint32_t groupnumber, uint16_t
1041 1041
1042 if (reason == GROUPCHAT_CLOSE_REASON_INTRODUCER) { 1042 if (reason == GROUPCHAT_CLOSE_REASON_INTRODUCER) {
1043 --g->num_introducer_connections; 1043 --g->num_introducer_connections;
1044 send_peer_introduced(g_c, g->close[i].number, g->close[i].group_number); 1044
1045 if (g->close[i].type == GROUPCHAT_CLOSE_ONLINE) {
1046 send_peer_introduced(g_c, g->close[i].number, g->close[i].group_number);
1047 }
1045 } 1048 }
1046 1049
1047 if (g->close[i].reasons == 0) { 1050 if (g->close[i].reasons == 0) {
@@ -2237,6 +2240,10 @@ static void handle_direct_packet(Group_Chats *g_c, uint32_t groupnumber, const u
2237 return; 2240 return;
2238 } 2241 }
2239 2242
2243 if (g->close[close_index].type != GROUPCHAT_CLOSE_ONLINE) {
2244 return;
2245 }
2246
2240 send_peers(g_c, groupnumber, g->close[close_index].number, g->close[close_index].group_number); 2247 send_peers(g_c, groupnumber, g->close[close_index].number, g->close[close_index].group_number);
2241 } 2248 }
2242 2249
@@ -2582,6 +2589,10 @@ static void handle_message_packet_group(Group_Chats *g_c, uint32_t groupnumber,
2582 return; 2589 return;
2583 } 2590 }
2584 2591
2592 if (g->close[close_index].type != GROUPCHAT_CLOSE_ONLINE) {
2593 return;
2594 }
2595
2585 /* If we don't know the peer this packet came from, then we query the 2596 /* If we don't know the peer this packet came from, then we query the
2586 * list of peers from the relaying peer. 2597 * list of peers from the relaying peer.
2587 * (They would not have relayed it if they didn't know the peer.) */ 2598 * (They would not have relayed it if they didn't know the peer.) */