mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 19:13:11 +08:00
fixed clients overlapping from one test to another by:
- adding client and server wrappers to verify the clientid starts with the testname - adding disposable baseclass - clear disconnect handler from client so it does not try to reconnect after it is disposed - moved code from dispose to cleanup in case it is called in a stop method as dispose may only be called once while start / stop may be called multiple times
This commit is contained in:
@@ -13,7 +13,7 @@ using MQTTnet.Server.Status;
|
||||
|
||||
namespace MQTTnet.Server
|
||||
{
|
||||
public class MqttClientSessionsManager : IDisposable
|
||||
public class MqttClientSessionsManager : Disposable
|
||||
{
|
||||
private readonly AsyncQueue<MqttEnqueuedApplicationMessage> _messageQueue = new AsyncQueue<MqttEnqueuedApplicationMessage>();
|
||||
|
||||
@@ -145,9 +145,13 @@ namespace MQTTnet.Server
|
||||
_logger.Verbose("Session for client '{0}' deleted.", clientId);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
_messageQueue?.Dispose();
|
||||
if (disposing)
|
||||
{
|
||||
_messageQueue?.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private async Task TryProcessQueuedApplicationMessagesAsync(CancellationToken cancellationToken)
|
||||
|
||||
Reference in New Issue
Block a user