Commit 0286e868 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Fixed message delivery to resource with highest priority. JM-11


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@208 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1ee9f864
......@@ -168,6 +168,9 @@ public class SessionImpl implements Session {
public Presence setPresence(Presence presence) {
Presence oldPresence = this.presence;
this.presence = presence;
if (oldPresence.getPriority() != this.presence.getPriority()) {
sessionManager.changePriority(getAddress(), this.presence.getPriority());
}
return oldPresence;
}
......
......@@ -311,6 +311,12 @@ public class SessionManagerImpl extends BasicModule implements SessionManager,
return;
}
resources.changePriority(sender, priority);
// Get the session with highest priority
Session defaultSession = resources.getDefaultSession();
// Update the route to the bareJID with the session with highest priority
routingTable.addRoute(new XMPPAddress(defaultSession.getAddress().getNamePrep(),
defaultSession.getAddress().getHostPrep(), ""), defaultSession);
}
finally {
sessionLock.writeLock().unlock();
......
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