fix CSV list bug, collect CSV list into constant, provide better logging on disabled SSL
This commit is contained in:
@@ -54,6 +54,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class NettyAcceptor implements ServerAcceptor {
|
public class NettyAcceptor implements ServerAcceptor {
|
||||||
|
|
||||||
|
private static final String MQTT_SUBPROTOCOL_CSV_LIST = "mqtt, mqttv3.1, mqttv3.1.1";
|
||||||
|
|
||||||
static class WebSocketFrameToByteBufDecoder extends MessageToMessageDecoder<BinaryWebSocketFrame> {
|
static class WebSocketFrameToByteBufDecoder extends MessageToMessageDecoder<BinaryWebSocketFrame> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -178,7 +180,7 @@ public class NettyAcceptor implements ServerAcceptor {
|
|||||||
pipeline.addLast("httpEncoder", new HttpResponseEncoder());
|
pipeline.addLast("httpEncoder", new HttpResponseEncoder());
|
||||||
pipeline.addLast("httpDecoder", new HttpRequestDecoder());
|
pipeline.addLast("httpDecoder", new HttpRequestDecoder());
|
||||||
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
||||||
pipeline.addLast("webSocketHandler", new WebSocketServerProtocolHandler("/mqtt", "mqtt, mqttv3.1, mqttv3.1.1"));
|
pipeline.addLast("webSocketHandler", new WebSocketServerProtocolHandler("/mqtt", MQTT_SUBPROTOCOL_CSV_LIST));
|
||||||
pipeline.addLast("ws2bytebufDecoder", new WebSocketFrameToByteBufDecoder());
|
pipeline.addLast("ws2bytebufDecoder", new WebSocketFrameToByteBufDecoder());
|
||||||
pipeline.addLast("bytebuf2wsEncoder", new ByteBufToWebSocketFrameEncoder());
|
pipeline.addLast("bytebuf2wsEncoder", new ByteBufToWebSocketFrameEncoder());
|
||||||
pipeline.addFirst("idleStateHandler", new IdleStateHandler(0, 0, Constants.DEFAULT_CONNECT_TIMEOUT));
|
pipeline.addFirst("idleStateHandler", new IdleStateHandler(0, 0, Constants.DEFAULT_CONNECT_TIMEOUT));
|
||||||
@@ -196,7 +198,7 @@ public class NettyAcceptor implements ServerAcceptor {
|
|||||||
String sslPortProp = props.getProperty(BrokerConstants.SSL_PORT_PROPERTY_NAME);
|
String sslPortProp = props.getProperty(BrokerConstants.SSL_PORT_PROPERTY_NAME);
|
||||||
if (sslPortProp == null) {
|
if (sslPortProp == null) {
|
||||||
//Do nothing no SSL configured
|
//Do nothing no SSL configured
|
||||||
LOG.info("SSL is disabled");
|
LOG.info("SSL MQTT is disabled because there is no value in properties for key BrokerConstants.SSL_PORT_PROPERTY_NAME");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +229,7 @@ public class NettyAcceptor implements ServerAcceptor {
|
|||||||
String sslPortProp = props.getProperty(BrokerConstants.WSS_PORT_PROPERTY_NAME);
|
String sslPortProp = props.getProperty(BrokerConstants.WSS_PORT_PROPERTY_NAME);
|
||||||
if (sslPortProp == null) {
|
if (sslPortProp == null) {
|
||||||
//Do nothing no SSL configured
|
//Do nothing no SSL configured
|
||||||
LOG.info("SSL is disabled");
|
LOG.info("SSL websocket is disabled because there is no value in properties for key BrokerConstants.WSS_PORT_PROPERTY_NAME");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int sslPort = Integer.parseInt(sslPortProp);
|
int sslPort = Integer.parseInt(sslPortProp);
|
||||||
@@ -242,7 +244,7 @@ public class NettyAcceptor implements ServerAcceptor {
|
|||||||
pipeline.addLast("httpEncoder", new HttpResponseEncoder());
|
pipeline.addLast("httpEncoder", new HttpResponseEncoder());
|
||||||
pipeline.addLast("httpDecoder", new HttpRequestDecoder());
|
pipeline.addLast("httpDecoder", new HttpRequestDecoder());
|
||||||
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
||||||
pipeline.addLast("webSocketHandler", new WebSocketServerProtocolHandler("/mqtt", "mqtt mqttv3.1, mqttv3.1.1"));
|
pipeline.addLast("webSocketHandler", new WebSocketServerProtocolHandler("/mqtt", MQTT_SUBPROTOCOL_CSV_LIST));
|
||||||
pipeline.addLast("ws2bytebufDecoder", new WebSocketFrameToByteBufDecoder());
|
pipeline.addLast("ws2bytebufDecoder", new WebSocketFrameToByteBufDecoder());
|
||||||
pipeline.addLast("bytebuf2wsEncoder", new ByteBufToWebSocketFrameEncoder());
|
pipeline.addLast("bytebuf2wsEncoder", new ByteBufToWebSocketFrameEncoder());
|
||||||
pipeline.addFirst("idleStateHandler", new IdleStateHandler(0, 0, Constants.DEFAULT_CONNECT_TIMEOUT));
|
pipeline.addFirst("idleStateHandler", new IdleStateHandler(0, 0, Constants.DEFAULT_CONNECT_TIMEOUT));
|
||||||
|
|||||||
Reference in New Issue
Block a user