reflector: Fix removing conference participant

Delete the participant only after we take it's address. Fixes deleting the
wrong port.
This commit is contained in:
Martin Piatka
2023-05-03 14:17:45 +02:00
parent 801b9b6702
commit ede867ca93

View File

@@ -932,8 +932,6 @@ int main(int argc, char **argv)
}
const double participant_timeout = 10.0;
if(tv_diff(t, it->last_recv) > participant_timeout){
std::swap(*it, participants.back());
participants.pop_back();
log_msg(LOG_LEVEL_NOTICE, "Removing participant\n");
std::string msg = "delete-port ";
auto addr = reinterpret_cast<struct sockaddr *>(&it->addr);
@@ -941,6 +939,9 @@ int main(int argc, char **argv)
get_sockaddr_addr_str(addr, addr_str, sizeof(addr_str));
msg += get_replica_mod_name(addr_str, get_sockaddr_addr_port(addr));
std::swap(*it, participants.back());
participants.pop_back();
struct msg_universal *m = (struct msg_universal *) new_message(sizeof(struct msg_universal));
strncpy(m->text, msg.c_str(), sizeof(m->text) - 1);
log_msg(LOG_LEVEL_NOTICE, "Msg: %s\n", m->text);