Commit a22d917b authored by Dave Cridland's avatar Dave Cridland

Merge pull request #531 from tevans/OF-954

OF-954: Cleanup MUC rooms for defunct node
parents 1ba9c8a3 dab1f718
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package org.jivesoftware.openfire.muc; package org.jivesoftware.openfire.muc;
import java.nio.charset.StandardCharsets;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
...@@ -855,7 +856,18 @@ public class MultiUserChatManager extends BasicModule implements ClusterEventLis ...@@ -855,7 +856,18 @@ public class MultiUserChatManager extends BasicModule implements ClusterEventLis
@Override @Override
public void leftCluster(byte[] nodeID) { 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 @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