Skip to content

Commit

Permalink
Cleanup CometClient state when disconnecting bayeux client
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaholst committed May 26, 2024
1 parent e9fa9d7 commit 19144ec
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,6 @@ public void startConnect(final SqueezeService service, boolean autoConnect) {

// Start the background connect
mBackgroundHandler.post(() -> {
mPendingRequests.clear();
mPendingBrowseRequests.clear();
mCommandQueue.clear();
mCurrentCommand = false;
cleanupBayeuxClient();

final Preferences.ServerAddress serverAddress = Squeezer.getPreferences().getServerAddress();
Expand Down Expand Up @@ -310,6 +306,10 @@ protected void customize(org.eclipse.jetty.client.api.Request request) {
}

private void cleanupBayeuxClient() {
mPendingRequests.clear();
mPendingBrowseRequests.clear();
mCommandQueue.clear();
mCurrentCommand = false;
if (mBayeuxClient != null) {
for (String channelId: List.of(Channel.META_HANDSHAKE, Channel.META_CONNECT)) {
ClientSessionChannel channel = mBayeuxClient.getChannel(channelId);
Expand Down

0 comments on commit 19144ec

Please sign in to comment.