Fix build errors.

This commit is contained in:
Christian
2021-11-13 10:28:56 +01:00
parent b5b713570f
commit 28310c69bb
4 changed files with 14 additions and 17 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -14,7 +14,7 @@ using MQTTnet.Protocol;
namespace MQTTnet.Server
{
public sealed class MqttClient : IDisposable
public sealed class MqttClient
{
readonly Dictionary<ushort, string> _topicAlias = new Dictionary<ushort, string>();
readonly MqttPacketDispatcher _packetDispatcher = new MqttPacketDispatcher();
@@ -138,7 +138,7 @@ namespace MQTTnet.Server
_clients.Remove(client.Id);
}
if ((!_options.EnablePersistentSessions) || (!clientConnection.Session.IsPersistent))
if ((!_options.EnablePersistentSessions) || !client.Session.IsPersistent)
{
await DeleteSessionAsync(client.Id).ConfigureAwait(false);
}
@@ -423,13 +423,13 @@ namespace MQTTnet.Server
MqttConnectPacket connectPacket,
MqttConnAckPacket connAckPacket,
IMqttChannelAdapter channelAdapter,
MqttConnectionValidatorContext context)
ValidatingConnectionEventArgs validatingConnectionEventArgs)
{
MqttClient connection;
bool sessionShouldPersist;
if (context.ProtocolVersion == MqttProtocolVersion.V500)
if (validatingConnectionEventArgs.ProtocolVersion == MqttProtocolVersion.V500)
{
// MQTT 5.0 section 3.1.2.11.2
// The Client and Server MUST store the Session State after the Network Connection is closed if the Session Expiry Interval is greater than 0 [MQTT-3.1.2-23].
@@ -439,7 +439,7 @@ namespace MQTTnet.Server
// in each time it connects.
// Persist if SessionExpiryInterval != 0, but may start with a clean session
sessionShouldPersist = context.SessionExpiryInterval != 0;
sessionShouldPersist = validatingConnectionEventArgs.SessionExpiryInterval != 0;
}
else
{
@@ -459,14 +459,14 @@ namespace MQTTnet.Server
{
if (!_sessions.TryGetValue(connectPacket.ClientId, out session))
{
session = CreateSession(connectPacket.ClientId, sessionItems, context.SessionItems, sessionShouldPersist);
session = CreateSession(connectPacket.ClientId, validatingConnectionEventArgs.SessionItems, sessionShouldPersist);
}
else
{
if (connectPacket.CleanSession)
{
_logger.Verbose("Deleting existing session of client '{0}'.", connectPacket.ClientId);
session = CreateSession(connectPacket.ClientId, context.SessionItems, sessionShouldPersist);
session = CreateSession(connectPacket.ClientId, validatingConnectionEventArgs.SessionItems, sessionShouldPersist);
}
else
{
@@ -573,12 +573,13 @@ namespace MQTTnet.Server
_rootLogger);
}
MqttClientSession CreateSession(string clientId, IDictionary<object, object> sessionItems, bool isPersistent)
MqttSession CreateSession(string clientId, IDictionary<object, object> sessionItems, bool isPersistent)
{
_logger.Verbose("Created a new session for client '{0}'.", clientId);
return new MqttSession(
clientId,
isPersistent,
sessionItems,
_options,
_eventContainer,
@@ -590,11 +591,6 @@ namespace MQTTnet.Server
{
_createConnectionSyncRoot?.Dispose();
foreach (var clientConnection in _clients.Values)
{
clientConnection.Dispose();
}
foreach (var session in _sessions.Values)
{
session.Dispose();