Fix reference count issue
This commit is contained in:
		
							parent
							
								
									afdcc6ed3f
								
							
						
					
					
						commit
						9d651a7252
					
				@ -237,6 +237,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        deviceSessionCtx.getMsgQueue().add(msg);
 | 
			
		||||
        ReferenceCountUtil.retain(msg);
 | 
			
		||||
        processMsgQueue(ctx); //Under the normal conditions the msg queue will contain 0 messages. Many messages will be processed on device connect event in separate thread pool
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -252,6 +253,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
 | 
			
		||||
                    while ((msg = deviceSessionCtx.getMsgQueue().poll()) != null) {
 | 
			
		||||
                        deviceSessionCtx.getMsgQueueSize().decrementAndGet();
 | 
			
		||||
                        processRegularSessionMsg(ctx, msg);
 | 
			
		||||
                        ReferenceCountUtil.safeRelease(msg);
 | 
			
		||||
                    }
 | 
			
		||||
                } finally {
 | 
			
		||||
                    deviceSessionCtx.getMsgQueueProcessorLock().unlock();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user