Commit f363143c authored by Dave Cridland's avatar Dave Cridland Committed by GitHub

Merge pull request #632 from surevine/routing

OF-1171 Update message routing to RFC 6120
parents 12b4559b 5ee189d1
...@@ -546,6 +546,18 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust ...@@ -546,6 +546,18 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust
// Get the sessions with non-negative priority for message carbons processing. // Get the sessions with non-negative priority for message carbons processing.
List<ClientSession> nonNegativePrioritySessions = getNonNegativeSessions(sessions, 0); List<ClientSession> nonNegativePrioritySessions = getNonNegativeSessions(sessions, 0);
if (packet.getType() == Message.Type.error) {
// Errors should be dropped at this point.
Log.debug("Error stanza to bare JID discarded: {}", packet.toXML());
return true; // Not offline.
}
if (packet.getType() == Message.Type.groupchat) {
// Surreal message type; cannot occur.
Log.debug("Groupchat stanza to bare JID discarded: {}", packet.toXML());
return false; // Maybe offline has an idea?
}
if (nonNegativePrioritySessions.isEmpty()) { if (nonNegativePrioritySessions.isEmpty()) {
// No session is available so store offline // No session is available so store offline
Log.debug("Unable to route packet. No session is available so store offline. {} ", packet.toXML()); Log.debug("Unable to route packet. No session is available so store offline. {} ", packet.toXML());
...@@ -554,8 +566,11 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust ...@@ -554,8 +566,11 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust
// Check for message carbons enabled sessions and send the message to them. // Check for message carbons enabled sessions and send the message to them.
for (ClientSession session : nonNegativePrioritySessions) { for (ClientSession session : nonNegativePrioritySessions) {
if (packet.getType() == Message.Type.headline) {
// Headline messages are broadcast.
session.process(packet);
// Deliver to each session, if is message carbons enabled. // Deliver to each session, if is message carbons enabled.
if (shouldCarbonCopyToResource(session, packet, isPrivate)) { } else if (shouldCarbonCopyToResource(session, packet, isPrivate)) {
session.process(packet); session.process(packet);
// Deliver to each session if property route.really-all-resources is true // Deliver to each session if property route.really-all-resources is true
// (in case client does not support carbons) // (in case client does not support carbons)
...@@ -563,9 +578,14 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust ...@@ -563,9 +578,14 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust
session.process(packet); session.process(packet);
} }
} }
if (JiveGlobals.getBooleanProperty("route.really-all-resources", false)) if (packet.getType() == Message.Type.headline) {
return true; return true;
}
if (JiveGlobals.getBooleanProperty("route.really-all-resources", false)) {
return true;
}
// Get the highest priority sessions for normal processing. // Get the highest priority sessions for normal processing.
List<ClientSession> highestPrioritySessions = getHighestPrioritySessions(nonNegativePrioritySessions); List<ClientSession> highestPrioritySessions = getHighestPrioritySessions(nonNegativePrioritySessions);
......
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