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 @@ -186,14 +186,16 @@ public void run() {
186186 catch (IOException ioe ) {
187187 //@TRACE 853=Stopping due to IOException
188188 log .fine (CLASS_NAME ,methodName ,"853" );
189- synchronized (lifecycle ) {
190- target_state = State .STOPPED ;
191- }
192- // An EOFException could be raised if the broker processes the
193- // DISCONNECT and ends the socket before we complete. As such,
194- // only shutdown the connection if we're not already shutting down.
195- if (!clientComms .isDisconnecting ()) {
196- clientComms .shutdownConnection (token , new MqttException (MqttException .REASON_CODE_CONNECTION_LOST , ioe ));
189+ if (target_state != State .STOPPED ) {
190+ synchronized (lifecycle ) {
191+ target_state = State .STOPPED ;
192+ }
193+ // An EOFException could be raised if the broker processes the
194+ // DISCONNECT and ends the socket before we complete. As such,
195+ // only shutdown the connection if we're not already shutting down.
196+ if (!clientComms .isDisconnecting ()) {
197+ clientComms .shutdownConnection (token , new MqttException (MqttException .REASON_CODE_CONNECTION_LOST , ioe ));
198+ }
197199 }
198200 }
199201 finally {
You can’t perform that action at this time.
0 commit comments