Skip to content

Commit 53d07c6

Browse files
author
Stan Surmay
committed
Fixes #194 - ignore shutdownConnection if ClientComms already closed
it is possible for multiple places to call shutdownConnection what we have observed is that shutdownConnection can be called, then close, and then another shutdownConnection the second shutdownConnection is still being run even though the ClientComms is now closed (stoppingComms is false because the original shutdownConnection is done executing and closePending is false because close was not called as shutdownConnection was running) this can cause NPE because close has already destroyed the class Signed-off-by: Stan Surmay <ssurmay@bandwidth.com>
1 parent 9c9b344 commit 53d07c6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • org.eclipse.paho.client.mqttv3/src/main/java-templates/org/eclipse/paho/client/mqttv3/internal

org.eclipse.paho.client.mqttv3/src/main/java-templates/org/eclipse/paho/client/mqttv3/internal/ClientComms.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public void shutdownConnection(MqttToken token, MqttException reason) {
293293
// This method could concurrently be invoked from many places only allow it
294294
// to run once.
295295
synchronized(conLock) {
296-
if (stoppingComms || closePending) {
296+
if (stoppingComms || closePending || isClosed()) {
297297
return;
298298
}
299299
stoppingComms = true;

0 commit comments

Comments
 (0)