*/
package org.opendaylight.openflowplugin.impl.connection.listener;
+import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
public class SystemNotificationsListenerImpl implements SystemNotificationsListener {
private ConnectionContext connectionContext;
+ HandshakeContext handshakeContext;
private static final Logger LOG = LoggerFactory.getLogger(SystemNotificationsListenerImpl.class);
@VisibleForTesting
static final long MAX_ECHO_REPLY_TIMEOUT = 2000;
-
- /**
- * @param connectionContext
- */
- public SystemNotificationsListenerImpl(ConnectionContext connectionContext) {
+ public SystemNotificationsListenerImpl(final ConnectionContext connectionContext,
+ final HandshakeContext handshakeContext) {
this.connectionContext = connectionContext;
+ this.handshakeContext = handshakeContext;
}
@Override
public void onDisconnectEvent(DisconnectEvent notification) {
- // TODO Auto-generated method stub
disconnect();
}
private void disconnect() {
final ConnectionAdapter connectionAdapter = connectionContext.getConnectionAdapter();
short auxId = -1;
- if (null != connectionContext.getFeatures()) {
+ if (null != connectionContext.getFeatures() && null != connectionContext.getFeatures().getAuxiliaryId()) {
auxId = connectionContext.getFeatures().getAuxiliaryId();
}
final Short auxiliaryId = auxId;
});
connectionContext.propagateClosingConnection();
+ try {
+ handshakeContext.close();
+ } catch (Exception e) {
+ LOG.debug("Closing of handshake context wasn't successfull. {}", e);
+ }
}
-
}