import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
+import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext;
import org.opendaylight.openflowplugin.api.openflow.connection.OutboundQueueProvider;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.SessionStatistics;
private static final Logger LOG = LoggerFactory.getLogger(ConnectionContextImpl.class);
private OutboundQueueProvider outboundQueueProvider;
private OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration;
+ private HandshakeContext handshakeContext;
/**
* @param connectionAdapter
connectionState = ConnectionContext.CONNECTION_STATE.RIP;
unregisterOutboundQueue();
+ closeHandshakeContext();
+
if (getConnectionAdapter().isAlive()) {
getConnectionAdapter().disconnect();
}
}
}
+ private void closeHandshakeContext() {
+ if (handshakeContext != null) {
+ try {
+ handshakeContext.close();
+ } catch (Exception e) {
+ LOG.info("handshake context closing failed: ", e);
+ } finally {
+ handshakeContext = null;
+ }
+ }
+ }
+
@Override
public void onConnectionClosed() {
if (null == nodeId){
getConnectionState());
unregisterOutboundQueue();
-
+ closeHandshakeContext();
propagateDeviceDisconnectedEvent();
}
public void changeStateToWorking() {
connectionState = CONNECTION_STATE.WORKING;
}
+
+ @Override
+ public void setHandshakeContext(HandshakeContext handshakeContext) {
+ this.handshakeContext = handshakeContext;
+ }
}