Browse Source

fixed the other timing issue

release/3.x.x
Jan Eggers 7 years ago
parent
commit
acbf9153f4
2 changed files with 6 additions and 2 deletions
  1. +4
    -2
      MQTTnet.Core/Server/MqttClientSession.cs
  2. +2
    -0
      Tests/MQTTnet.Core.Tests/MqttServerTests.cs

+ 4
- 2
MQTTnet.Core/Server/MqttClientSession.cs View File

@@ -94,9 +94,11 @@ namespace MQTTnet.Core.Server
} }
finally finally
{ {
if (_willMessage != null)
var willMessage = _willMessage;
if (willMessage != null)
{ {
_sessionsManager.DispatchApplicationMessage(this, _willMessage);
_willMessage = null; //clear willmessage so it is send just once
_sessionsManager.DispatchApplicationMessage(this, willMessage);
} }
} }
} }


+ 2
- 0
Tests/MQTTnet.Core.Tests/MqttServerTests.cs View File

@@ -76,6 +76,8 @@ namespace MQTTnet.Core.Tests
await c2.DisconnectAsync(); await c2.DisconnectAsync();


await Task.Delay(1000); await Task.Delay(1000);

await c1.DisconnectAsync();
} }
finally finally
{ {


Loading…
Cancel
Save