Commit 6259bad9 authored by Tom Evans's avatar Tom Evans Committed by Christian Schudt

OF-954: Cleanup MUC rooms for defunct node

Patch submitted by community member lukzie.
parent 751a67df
......@@ -18,6 +18,7 @@
*/
package org.jivesoftware.openfire.muc;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
......@@ -855,7 +856,18 @@ public class MultiUserChatManager extends BasicModule implements ClusterEventLis
@Override
public void leftCluster(byte[] nodeID) {
// Do nothing. An unavailable presence will be created for occupants hosted in the leaving cluster node.
// Remove all room occupants linked to the defunct node as their sessions are cleaned out earlier
Log.debug("Removing orphaned occupants associated with defunct node: " + new String(nodeID, StandardCharsets.UTF_8));
for (MultiUserChatService service : getMultiUserChatServices()) {
for (MUCRoom mucRoom : service.getChatRooms()) {
for (MUCRole mucRole : mucRoom.getOccupants()) {
if (mucRole.getNodeID().equals(nodeID)) {
mucRoom.leaveRoom(mucRole);
}
}
}
}
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment