Do a proper disconnect when deleting a connector.
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / listener / NetconfDeviceCommunicator.java
index 93ac945f2d2c9c9cc8479796ada6a27906bab102..91407a573298a3ee83f81c29a7f098913c442620 100644 (file)
@@ -246,10 +246,8 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
             initFuture.cancel(false);
         }
         // Disconnect from device
-        if(session != null) {
-            session.close();
-            // tear down not necessary, called indirectly by above close
-        }
+        // tear down not necessary, called indirectly by the close in disconnect()
+        disconnect();
     }
 
     @Override