File tree Expand file tree Collapse file tree
org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,14 +180,16 @@ public void run() {
180180 catch (IOException ioe ) {
181181 //@TRACE 853=Stopping due to IOException
182182 log .fine (CLASS_NAME ,methodName ,"853" );
183- synchronized (lifecycle ) {
184- target_state = State .STOPPED ;
185- }
186- // An EOFException could be raised if the broker processes the
187- // DISCONNECT and ends the socket before we complete. As such,
188- // only shutdown the connection if we're not already shutting down.
189- if (!clientComms .isDisconnecting ()) {
190- clientComms .shutdownConnection (token , new MqttException (MqttException .REASON_CODE_CONNECTION_LOST , ioe ));
183+ if (target_state != State .STOPPED ) {
184+ synchronized (lifecycle ) {
185+ target_state = State .STOPPED ;
186+ }
187+ // An EOFException could be raised if the broker processes the
188+ // DISCONNECT and ends the socket before we complete. As such,
189+ // only shutdown the connection if we're not already shutting down.
190+ if (!clientComms .isDisconnecting ()) {
191+ clientComms .shutdownConnection (token , new MqttException (MqttException .REASON_CODE_CONNECTION_LOST , ioe ));
192+ }
191193 }
192194 }
193195 finally {
You can’t perform that action at this time.
0 commit comments