mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-18 02:13:00 +08:00
improved behavior when multiple connections fight over a session
This commit is contained in:
@@ -257,6 +257,15 @@ namespace MQTTnet.Server
|
||||
Session.WillMessage = null;
|
||||
}
|
||||
|
||||
if (_isTakeover)
|
||||
{
|
||||
// dont use SendAsync here _cancellationToken is already cancelled
|
||||
await _channelAdapter.SendPacketAsync(new MqttDisconnectPacket()
|
||||
{
|
||||
ReasonCode = MqttDisconnectReasonCode.SessionTakenOver
|
||||
}, TimeSpan.Zero, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
_packetDispatcher.Reset();
|
||||
|
||||
_channelAdapter.ReadingPacketStartedCallback = null;
|
||||
|
||||
Reference in New Issue
Block a user