@@ -133,6 +133,7 @@ public void operationComplete(ChannelFuture future) throws Exception {
133133 private boolean nettyTcpNodelay ;
134134 private boolean nettySoKeepalive ;
135135 private int nettyChannelTimeoutSeconds ;
136+ private int nettyChannelHandshakeTimeoutSeconds ;
136137 private int maxBytesInMessage ;
137138
138139 private Class <? extends ServerSocketChannel > channelClass ;
@@ -145,6 +146,8 @@ public void initialize(NewNettyMQTTHandler mqttHandler, IConfig props, ISslConte
145146 nettyTcpNodelay = props .boolProp (BrokerConstants .NETTY_TCP_NODELAY_PROPERTY_NAME , true );
146147 nettySoKeepalive = props .boolProp (BrokerConstants .NETTY_SO_KEEPALIVE_PROPERTY_NAME , true );
147148 nettyChannelTimeoutSeconds = props .intProp (BrokerConstants .NETTY_CHANNEL_TIMEOUT_SECONDS_PROPERTY_NAME , 10 );
149+ nettyChannelHandshakeTimeoutSeconds = props .intProp (
150+ BrokerConstants .NETTY_CHANNEL_HANDSHAKE_TIMEOUT_SECONDS_PROPERTY_NAME , 10 );
148151 maxBytesInMessage = props .intProp (BrokerConstants .NETTY_MAX_BYTES_PROPERTY_NAME ,
149152 BrokerConstants .DEFAULT_NETTY_MAX_BYTES_IN_MESSAGE );
150153
@@ -414,6 +417,7 @@ public void close() {
414417 }
415418
416419 private ChannelHandler createSslHandler (SocketChannel channel , SslContext sslContext , boolean needsClientAuth ) {
420+ SslHandler handler ;
417421 SSLEngine sslEngine = sslContext .newEngine (
418422 channel .alloc (),
419423 channel .remoteAddress ().getHostString (),
@@ -422,6 +426,10 @@ private ChannelHandler createSslHandler(SocketChannel channel, SslContext sslCon
422426 if (needsClientAuth ) {
423427 sslEngine .setNeedClientAuth (true );
424428 }
425- return new SslHandler (sslEngine );
429+
430+ handler = new SslHandler (sslEngine );
431+ handler .setHandshakeTimeoutMillis (nettyChannelHandshakeTimeoutSeconds * 1000 );
432+
433+ return handler ;
426434 }
427435}
0 commit comments