MQTTnet icon indicating copy to clipboard operation
MQTTnet copied to clipboard

incorrect behaviour of IMqttServerClientMessageQueueInterceptor

Open alex-bermishev opened this issue 3 years ago • 0 comments

Describe the bug

incorrect behaviour of MqttClientMessageQueueInterceptorContext.AcceptEnqueue

Which project is your bug related to?

  • Server

To Reproduce

Steps to reproduce the behavior: setting MqttClientMessageQueueInterceptorContext.AcceptEnqueue flag to false, stops client message queue processing

Expected behavior

MqttClientMessageQueueInterceptorContext.AcceptEnqueue should control sending specific message to specific client only

Additional context / logging

https://github.com/chkr1011/MQTTnet/blob/8f1d4e3c22f3226570eec681bccef3a88c4ebd16/Source/MQTTnet/Server/MqttClientConnection.cs#L424

as we can see, return is called once context.AcceptEnqueue == false that stops https://github.com/chkr1011/MQTTnet/blob/8f1d4e3c22f3226570eec681bccef3a88c4ebd16/Source/MQTTnet/Server/MqttClientConnection.cs#L385

which was started at https://github.com/chkr1011/MQTTnet/blob/8f1d4e3c22f3226570eec681bccef3a88c4ebd16/Source/MQTTnet/Server/MqttClientConnection.cs#L172

Possible fix

  if (!context.AcceptEnqueue || context.ApplicationMessage == null)
      continue;

alex-bermishev avatar May 17 '21 15:05 alex-bermishev

Thank you for reporting this issue and providing a solution. Unfortunately, the code has changed so that the fix is no longer needed.

chkr1011 avatar Sep 14 '22 06:09 chkr1011