Commit 0fa963be85c657eb6b57c4dc5303cdf59e9c2e0a
Committed by
Andrew Shvayka
1 parent
07eaf4dd
fix bug:Device reconnect abnormal when certificate authentication is turned on
Showing
2 changed files
with
5 additions
and
5 deletions
... | ... | @@ -100,12 +100,12 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement |
100 | 100 | private volatile DeviceSessionCtx deviceSessionCtx; |
101 | 101 | private volatile GatewaySessionHandler gatewaySessionHandler; |
102 | 102 | |
103 | - MqttTransportHandler(MqttTransportContext context) { | |
103 | + MqttTransportHandler(MqttTransportContext context,SslHandler sslHandler) { | |
104 | 104 | this.sessionId = UUID.randomUUID(); |
105 | 105 | this.context = context; |
106 | 106 | this.transportService = context.getTransportService(); |
107 | 107 | this.adaptor = context.getAdaptor(); |
108 | - this.sslHandler = context.getSslHandler(); | |
108 | + this.sslHandler = sslHandler; | |
109 | 109 | this.mqttQoSMap = new ConcurrentHashMap<>(); |
110 | 110 | this.deviceSessionCtx = new DeviceSessionCtx(sessionId, mqttQoSMap); |
111 | 111 | } | ... | ... |
... | ... | @@ -36,15 +36,15 @@ public class MqttTransportServerInitializer extends ChannelInitializer<SocketCha |
36 | 36 | @Override |
37 | 37 | public void initChannel(SocketChannel ch) { |
38 | 38 | ChannelPipeline pipeline = ch.pipeline(); |
39 | + SslHandler sslHandler = null; | |
39 | 40 | if (context.getSslHandlerProvider() != null) { |
40 | - SslHandler sslHandler = context.getSslHandlerProvider().getSslHandler(); | |
41 | + sslHandler = context.getSslHandlerProvider().getSslHandler(); | |
41 | 42 | pipeline.addLast(sslHandler); |
42 | - context.setSslHandler(sslHandler); | |
43 | 43 | } |
44 | 44 | pipeline.addLast("decoder", new MqttDecoder(context.getMaxPayloadSize())); |
45 | 45 | pipeline.addLast("encoder", MqttEncoder.INSTANCE); |
46 | 46 | |
47 | - MqttTransportHandler handler = new MqttTransportHandler(context); | |
47 | + MqttTransportHandler handler = new MqttTransportHandler(context,sslHandler); | |
48 | 48 | |
49 | 49 | pipeline.addLast(handler); |
50 | 50 | ch.closeFuture().addListener(handler); | ... | ... |