@@ -133,6 +133,7 @@ public void operationComplete(ChannelFuture future) throws Exception {
133
133
private boolean nettyTcpNodelay ;
134
134
private boolean nettySoKeepalive ;
135
135
private int nettyChannelTimeoutSeconds ;
136
+ private int nettyChannelHandshakeTimeoutSeconds ;
136
137
private int maxBytesInMessage ;
137
138
138
139
private Class <? extends ServerSocketChannel > channelClass ;
@@ -145,6 +146,8 @@ public void initialize(NewNettyMQTTHandler mqttHandler, IConfig props, ISslConte
145
146
nettyTcpNodelay = props .boolProp (BrokerConstants .NETTY_TCP_NODELAY_PROPERTY_NAME , true );
146
147
nettySoKeepalive = props .boolProp (BrokerConstants .NETTY_SO_KEEPALIVE_PROPERTY_NAME , true );
147
148
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 );
148
151
maxBytesInMessage = props .intProp (BrokerConstants .NETTY_MAX_BYTES_PROPERTY_NAME ,
149
152
BrokerConstants .DEFAULT_NETTY_MAX_BYTES_IN_MESSAGE );
150
153
@@ -414,6 +417,7 @@ public void close() {
414
417
}
415
418
416
419
private ChannelHandler createSslHandler (SocketChannel channel , SslContext sslContext , boolean needsClientAuth ) {
420
+ SslHandler handler ;
417
421
SSLEngine sslEngine = sslContext .newEngine (
418
422
channel .alloc (),
419
423
channel .remoteAddress ().getHostString (),
@@ -422,6 +426,10 @@ private ChannelHandler createSslHandler(SocketChannel channel, SslContext sslCon
422
426
if (needsClientAuth ) {
423
427
sslEngine .setNeedClientAuth (true );
424
428
}
425
- return new SslHandler (sslEngine );
429
+
430
+ handler = new SslHandler (sslEngine );
431
+ handler .setHandshakeTimeoutMillis (nettyChannelHandshakeTimeoutSeconds * 1000 );
432
+
433
+ return handler ;
426
434
}
427
435
}
0 commit comments