fix bug:Device reconnect abnormal when certificate authentication is turned on
This commit is contained in:
		
							parent
							
								
									07eaf4dd77
								
							
						
					
					
						commit
						0fa963be85
					
				@ -100,12 +100,12 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
 | 
			
		||||
    private volatile DeviceSessionCtx deviceSessionCtx;
 | 
			
		||||
    private volatile GatewaySessionHandler gatewaySessionHandler;
 | 
			
		||||
 | 
			
		||||
    MqttTransportHandler(MqttTransportContext context) {
 | 
			
		||||
    MqttTransportHandler(MqttTransportContext context,SslHandler sslHandler) {
 | 
			
		||||
        this.sessionId = UUID.randomUUID();
 | 
			
		||||
        this.context = context;
 | 
			
		||||
        this.transportService = context.getTransportService();
 | 
			
		||||
        this.adaptor = context.getAdaptor();
 | 
			
		||||
        this.sslHandler = context.getSslHandler();
 | 
			
		||||
        this.sslHandler = sslHandler;
 | 
			
		||||
        this.mqttQoSMap = new ConcurrentHashMap<>();
 | 
			
		||||
        this.deviceSessionCtx = new DeviceSessionCtx(sessionId, mqttQoSMap);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -36,15 +36,15 @@ public class MqttTransportServerInitializer extends ChannelInitializer<SocketCha
 | 
			
		||||
    @Override
 | 
			
		||||
    public void initChannel(SocketChannel ch) {
 | 
			
		||||
        ChannelPipeline pipeline = ch.pipeline();
 | 
			
		||||
        SslHandler sslHandler = null;
 | 
			
		||||
        if (context.getSslHandlerProvider() != null) {
 | 
			
		||||
            SslHandler sslHandler = context.getSslHandlerProvider().getSslHandler();
 | 
			
		||||
            sslHandler = context.getSslHandlerProvider().getSslHandler();
 | 
			
		||||
            pipeline.addLast(sslHandler);
 | 
			
		||||
            context.setSslHandler(sslHandler);
 | 
			
		||||
        }
 | 
			
		||||
        pipeline.addLast("decoder", new MqttDecoder(context.getMaxPayloadSize()));
 | 
			
		||||
        pipeline.addLast("encoder", MqttEncoder.INSTANCE);
 | 
			
		||||
 | 
			
		||||
        MqttTransportHandler handler = new MqttTransportHandler(context);
 | 
			
		||||
        MqttTransportHandler handler = new MqttTransportHandler(context,sslHandler);
 | 
			
		||||
 | 
			
		||||
        pipeline.addLast(handler);
 | 
			
		||||
        ch.closeFuture().addListener(handler);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user