Fix build errors.

This commit is contained in:
Christian
2021-12-01 22:05:52 +01:00
parent a9fcbd77e9
commit 46b54fd751
9 changed files with 32 additions and 111 deletions
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using MQTTnet.Diagnostics;
using MQTTnet.Formatter;
@@ -91,7 +91,7 @@ namespace MQTTnet.Client
/// Gets the session expiry interval.
/// The time after a session expires when it's not actively used.
/// </summary>
uint? SessionExpiryInterval { get; }
uint SessionExpiryInterval { get; }
/// <summary>
/// Gets the topic alias maximum.
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using MQTTnet.Diagnostics;
using MQTTnet.Formatter;
@@ -91,7 +91,7 @@ namespace MQTTnet.Client
/// Gets or sets the session expiry interval.
/// The time after a session expires when it's not actively used.
/// </summary>
public uint? SessionExpiryInterval { get; set; }
public uint SessionExpiryInterval { get; set; }
/// <summary>
/// Gets or sets the topic alias maximum.
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -112,7 +112,7 @@ namespace MQTTnet.Client
return this;
}
public MqttClientOptionsBuilder WithSessionExpiryInterval(uint? sessionExpiryInterval)
public MqttClientOptionsBuilder WithSessionExpiryInterval(uint sessionExpiryInterval)
{
_options.SessionExpiryInterval = sessionExpiryInterval;
return this;
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace MQTTnet.Packets
{
@@ -6,7 +6,7 @@ namespace MQTTnet.Packets
{
public uint? WillDelayInterval { get; set; }
public uint? SessionExpiryInterval { get; set; }
public uint SessionExpiryInterval { get; set; }
public string AuthenticationMethod { get; set; }
@@ -431,31 +431,6 @@ namespace MQTTnet.Server
sessionShouldPersist = !connectPacket.CleanSession;
}
bool sessionShouldPersist;
if (context.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].
//
// A Client that only wants to process messages while connected will set the Clean Start to 1 and set the Session Expiry Interval to 0.
// It will not receive Application Messages published before it connected and has to subscribe afresh to any topics that it is interested
// in each time it connects.
// Persist if SessionExpiryInterval != 0, but may start with a clean session
sessionShouldPersist = context.SessionExpiryInterval.GetValueOrDefault() != 0;
}
else
{
// MQTT 3.1.1 section 3.1.2.4: persist only if 'not CleanSession'
//
// If CleanSession is set to 1, the Client and Server MUST discard any previous Session and start a new one.
// This Session lasts as long as the Network Connection. State data associated with this Session MUST NOT be
// reused in any subsequent Session [MQTT-3.1.2-6].
sessionShouldPersist = !connectPacket.CleanSession;
}
using (await _createConnectionSyncRoot.WaitAsync(CancellationToken.None).ConfigureAwait(false))
{
MqttSession session;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -43,7 +43,7 @@ namespace MQTTnet.Server
/// <summary>
/// Session should persist if CleanSession was set to false (Mqtt3) or if SessionExpiryInterval != 0 (Mqtt5)
/// </summary>
public bool IsPersistent { get; }
public bool IsPersistent { get; set; }
public MqttPacketIdentifierProvider PacketIdentifierProvider { get; } = new MqttPacketIdentifierProvider();