OF-2012: Remove, instead of add, a route when a session becomes unavailable#1627
Conversation
|
I was triggered by debug logging that I added as part of #1626 - I noticed that the 'put' to the routing table continuously failed, as the route was already there. I'm assuming that this is an oversight that has lingered in the code for way to long. Given that it has been in the code for such a long time, it's probably pretty benign. My worry is that somehow, something now depends on this, which would make this PR potentially a breaking change. |
|
I don't think this is MR is right.
So, So, if I send: to indicate I'm away, then However, I do not believe that dropping the route to the client is the correct behaviour. There is still a route to the client. The "removeClientRoute" method is called when the session is actually removed. It's possible the existing behaviour of re-adding the route to the client is there to cover-up a bug somewhere where routes to clients are lost, and re-adding them ensures that the route still exists. |
I don't think that's right: Note that there are various types of presence ( The code is invoked in just one place: /**
* Set the presence of this session
*
* @param presence The presence for the session
*/
@Override
public void setPresence(Presence presence) {
Presence oldPresence = this.presence;
this.presence = presence;
if (oldPresence.isAvailable() && !this.presence.isAvailable()) {
// The client is no longer available
sessionManager.sessionUnavailable(this);
// Mark that the session is no longer initialized. This means that if the user sends
// an available presence again the session will be initialized again thus receiving
// offline messages and offline presence subscription requests
setInitialized(false);
// Notify listeners that the session is no longer available
PresenceEventDispatcher.unavailableSession(this, presence);
}Notice how, when |
|
Yeah, quite right, my bad, got my negatives all muddle up. However, I still have two concerns;
Overall, I think the route should only be dropped when the session ends - |
|
If I understand your argument correctly, then you're worried that this change might end up prematurely making session-related state switch to something that resembles 'offline' or 'ended' or 'unavailable' - something along those lines. I think we need not worry about that, given the code that also executes when this method is called. The implementation of
Given the nature of 2 and 3, I think we can safely deduce the intended behavior for 1. Thing 2 and 3 are unmodified by this PR. Their effects are pretty unambiguous: the session is made unavailable. Being "more careful" in the implementation of item 1 does not seem to be making much of a difference, as it's not called by other code. |
|
OK, I'll go with your suggestion ... |
No description provided.