Bug 2875 - fix initiating OFPT_HELLO over SSL from the controller 54/23954/2
authorMatus Marko <matus.marko@pantheon.sk>
Thu, 9 Jul 2015 13:25:05 +0000 (15:25 +0200)
committerMatus Marko <matus.marko@pantheon.sk>
Fri, 10 Jul 2015 08:32:00 +0000 (10:32 +0200)
Change-Id: I69a19898c2d4ea916f895d588dc9af20f036e1ef
Signed-off-by: Matus Marko <matus.marko@pantheon.sk>
.gitignore
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpChannelInitializer.java

index 1e44f73b973e0778968461368c8235e558ddca56..49e9ad865db30f135fc4446635a2bc7b8c38c3d1 100644 (file)
@@ -5,3 +5,6 @@ target/
 .externalToolBuilders/\r
 maven-eclipse.xml\r
 .checkstyle\r
+.idea\r
+*.iws\r
+*.iml\r
index 43277eaa79bd8ba11574db4babffb58107b8e9be..3be9f96f07eac4ad8b1b3c39ff46325576f7b817 100644 (file)
@@ -19,6 +19,8 @@ import java.util.concurrent.TimeUnit;
 
 import javax.net.ssl.SSLEngine;
 
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
 import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactory;
 import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactoryImpl;
 import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionFacade;
@@ -85,7 +87,16 @@ public class TcpChannelInitializer extends ProtocolChannelInitializer<SocketChan
                 SSLEngine engine = sslFactory.getServerContext().createSSLEngine();
                 engine.setNeedClientAuth(true);
                 engine.setUseClientMode(false);
-                ch.pipeline().addLast(PipelineHandlers.SSL_HANDLER.name(), new SslHandler(engine));
+                SslHandler ssl = new SslHandler(engine);
+                Future<Channel> handshakeFuture = ssl.handshakeFuture();
+                final ConnectionFacade finalConnectionFacade = connectionFacade;
+                handshakeFuture.addListener(new GenericFutureListener<Future<? super Channel>>() {
+                    @Override
+                    public void operationComplete(Future<? super Channel> future) throws Exception {
+                        finalConnectionFacade.fireConnectionReadyNotification();
+                    }
+                });
+                ch.pipeline().addLast(PipelineHandlers.SSL_HANDLER.name(), ssl);
             }
             ch.pipeline().addLast(PipelineHandlers.OF_FRAME_DECODER.name(),
                     new OFFrameDecoder(connectionFacade, tlsPresent));