Noticed this behavior in OF (at least since rev#9295):
-
U1 connects on S1 with resource R1, authenticates and sends initial presence
-
U1 connects on S1 with resource R2, authenticates and sends initial presence
-
U1/R1 receives presence from U1/R2, U1/R2 from U1/R1
-
U2 connects on S2, authenticates and sends initial presence
-
U2 sends a message to U1/R1 -> OK
-
U2 sends a message to U1/R2 -> OK
-
U2 sends 10 messages to U1/R3 or to R1 without mentioning the resource
–> messages are delivered alternatively and exclusively to U1/R1 and U1/R2
In RoutingTableImpl.routeToBareJID() the javadoc says that the rule for delivering is
-
Select resources with highest priority
-
Select resources with highest show value (chat, available, away, xa, dnd)
-
Select resource with most recent activity
There’s just an inversion in the comparison:
// Get session with most recent activity (and highest show value)
Collections.sort(targets, new Comparator() {
public int compare(ClientSession o1, ClientSession o2) {
return o1.getLastActiveDate().compareTo(o2.getLastActiveDate());
}
});
should be o2.getLastActiveDate().compareTo(o1.getLastActiveDate());
Resulting behavior is that the message is always delivered to the least recent activity resource.