Avoid sending group messages to a peer before we have its group number

This commit is contained in:
zugz (tox) 2019-01-05 22:02:45 +01:00
parent 6bc12232ac
commit 86935beb2f
No known key found for this signature in database
GPG Key ID: 6F2BDA289D04F249

View File

@ -1041,7 +1041,10 @@ static void remove_conn_reason(Group_Chats *g_c, uint32_t groupnumber, uint16_t
if (reason == GROUPCHAT_CLOSE_REASON_INTRODUCER) {
--g->num_introducer_connections;
send_peer_introduced(g_c, g->close[i].number, g->close[i].group_number);
if (g->close[i].type == GROUPCHAT_CLOSE_ONLINE) {
send_peer_introduced(g_c, g->close[i].number, g->close[i].group_number);
}
}
if (g->close[i].reasons == 0) {
@ -2237,6 +2240,10 @@ static void handle_direct_packet(Group_Chats *g_c, uint32_t groupnumber, const u
return;
}
if (g->close[close_index].type != GROUPCHAT_CLOSE_ONLINE) {
return;
}
send_peers(g_c, groupnumber, g->close[close_index].number, g->close[close_index].group_number);
}
@ -2582,6 +2589,10 @@ static void handle_message_packet_group(Group_Chats *g_c, uint32_t groupnumber,
return;
}
if (g->close[close_index].type != GROUPCHAT_CLOSE_ONLINE) {
return;
}
/* If we don't know the peer this packet came from, then we query the
* list of peers from the relaying peer.
* (They would not have relayed it if they didn't know the peer.) */