diff --git a/Squeezer/src/main/java/uk/org/ngo/squeezer/service/CometClient.java b/Squeezer/src/main/java/uk/org/ngo/squeezer/service/CometClient.java index 93abb275d..1ec0fccfa 100644 --- a/Squeezer/src/main/java/uk/org/ngo/squeezer/service/CometClient.java +++ b/Squeezer/src/main/java/uk/org/ngo/squeezer/service/CometClient.java @@ -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(); @@ -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);