Skip to content

Commit

Permalink
Fixes #1342
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Oct 11, 2013
1 parent 6675bcd commit 1c64032
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,27 @@ public void onAddAtmosphereResource(Broadcaster b, AtmosphereResource r) {
if (t == null) {
t = track(r);
}
logger.trace("Starting tracking the state of {} with broadcaster {}", r.uuid(), b.getID());
t.add(b);
}

@Override
public void onRemoveAtmosphereResource(Broadcaster b, AtmosphereResource r) {
// We track cancelled and resumed connection only.
BroadcasterTracker t = states.get(r.uuid());

// The BroadcasterTracker was swapped
if (t == null) {
onAddAtmosphereResource(b, r);
}

AtmosphereResourceEvent e = r.getAtmosphereResourceEvent();
if (t != null && (e.isClosedByClient() || !r.isResumed() && !e.isResumedOnTimeout())) {
logger.trace("Deleting the state of {} with broadcaster {}", r.uuid(), b.getID());
t.remove(b);
} else {
logger.trace("Keeping the state of {} with broadcaster {}", r.uuid(), b.getID());
logger.trace("State for {} with broadcaster {}", r.uuid(), t != null ? t.ids() : "");
logger.trace("State for {} with broadcaster {}", r.uuid(), t != null ? t.ids() : "null");

}
}
Expand Down

0 comments on commit 1c64032

Please sign in to comment.