MQTTnet icon indicating copy to clipboard operation
MQTTnet copied to clipboard

Suspend keep alive checking problem

Open alexstonehs opened this issue 8 years ago • 1 comments

Hi @Chkr1011, I have reviewed the code at Server/MqttClientSession.cs, and I recognized that OnAdapterReadingPacketCompleted and OnAdapterReadingPacketStarted fire event called Function _keepAliveMonitor?.Pause() / _keepAliveMonitor?.Resume() should be reverse, the current call cause Server/MqttClientKeepAliveMonitor.cs RunAsync() will never run into: if (!_isPaused && _lastPacketReceivedTracker.Elapsed.TotalSeconds >= keepAlivePeriod * 1.5D) { _logger.Warning(null, "Client '{0}': Did not receive any packet or keep alive signal.", _clientSession.ClientId); _clientSession.Stop(MqttClientDisconnectType.NotClean);

                    return;
                }

, so the KeepAlive thread could not process offline client correctly. I already leave comments on Server/MqttClientSession.cs code, please check it if the problem exists. Thank you

alexstonehs avatar Jul 20 '18 02:07 alexstonehs

I verified, its fixed in 2.8.2-rc1

JanEggers avatar Jul 30 '18 17:07 JanEggers