Remove unneeded _sealed_ keywords. Update docs.

This commit is contained in:
Christian Kratky
2018-05-30 20:56:20 +02:00
parent a10183628b
commit 9bea46adcb
43 changed files with 54 additions and 60 deletions
+4
View File
@@ -13,12 +13,16 @@
<releaseNotes> * [Core] Performance optimizations. <releaseNotes> * [Core] Performance optimizations.
* [Core] Due to performance reasons the timestamp of log messages is now in UTC format. * [Core] Due to performance reasons the timestamp of log messages is now in UTC format.
* [Core] Added several packet validations. * [Core] Added several packet validations.
* [Core] Log messages now contain the complete source path including parent components.
* [Core] The adapter now has an _Endpoint_ definition as string containing remote IP and port.
* [Client] Received messages are now processed in the worker thread by default. Added a new setting for switching back to dedicated threads. * [Client] Received messages are now processed in the worker thread by default. Added a new setting for switching back to dedicated threads.
* [ManagedClient] Fixed a loading issue of stored application messages (thanks to @JTrotta). * [ManagedClient] Fixed a loading issue of stored application messages (thanks to @JTrotta).
* [Server] Added support for other WebSocket sub protocol formats like mqttv-3.1.1 (thanks to @israellot). * [Server] Added support for other WebSocket sub protocol formats like mqttv-3.1.1 (thanks to @israellot).
* [Server] The takeover of an existing client sessions is now treated as a _clean_ disconnect of the previous client. * [Server] The takeover of an existing client sessions is now treated as a _clean_ disconnect of the previous client.
* [Server] The pending messages queue per client is now limited to 250 messages. Overflow strategy and count can be changed via options (thanks to @VladimirAkopyan) * [Server] The pending messages queue per client is now limited to 250 messages. Overflow strategy and count can be changed via options (thanks to @VladimirAkopyan)
* [Server] Keep alive checking is now suspended while large packages are being received (and thus the client is connected). Keep alive checking continues after a large packet is received completely. * [Server] Keep alive checking is now suspended while large packages are being received (and thus the client is connected). Keep alive checking continues after a large packet is received completely.
* [Server] Rewritten the _ConnectedClients_ API and added new features for disconnecting and Endpoint information (IP etc.).
* [Server] Added settings for disabling persistent sessions and defining a max pending messages queue size per session.
</releaseNotes> </releaseNotes>
<copyright>Copyright Christian Kratky 2016-2018</copyright> <copyright>Copyright Christian Kratky 2016-2018</copyright>
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags> <tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
@@ -9,7 +9,7 @@ using MQTTnet.Protocol;
namespace MQTTnet.Extensions.Rpc namespace MQTTnet.Extensions.Rpc
{ {
public sealed class MqttRpcClient : IDisposable public class MqttRpcClient : IDisposable
{ {
private readonly ConcurrentDictionary<string, TaskCompletionSource<byte[]>> _waitingCalls = new ConcurrentDictionary<string, TaskCompletionSource<byte[]>>(); private readonly ConcurrentDictionary<string, TaskCompletionSource<byte[]>> _waitingCalls = new ConcurrentDictionary<string, TaskCompletionSource<byte[]>>();
private readonly IMqttClient _mqttClient; private readonly IMqttClient _mqttClient;
@@ -13,7 +13,7 @@ using MQTTnet.Serializer;
namespace MQTTnet.Adapter namespace MQTTnet.Adapter
{ {
public sealed class MqttChannelAdapter : IMqttChannelAdapter public class MqttChannelAdapter : IMqttChannelAdapter
{ {
private const uint ErrorOperationAborted = 0x800703E3; private const uint ErrorOperationAborted = 0x800703E3;
private const int ReadBufferSize = 4096; // TODO: Move buffer size to config private const int ReadBufferSize = 4096; // TODO: Move buffer size to config
@@ -3,7 +3,7 @@ using System.IO;
namespace MQTTnet.Adapter namespace MQTTnet.Adapter
{ {
public sealed class ReceivedMqttPacket : IDisposable public class ReceivedMqttPacket : IDisposable
{ {
public ReceivedMqttPacket(byte fixedHeader, MemoryStream body) public ReceivedMqttPacket(byte fixedHeader, MemoryStream body)
{ {
@@ -2,7 +2,7 @@
namespace MQTTnet.Diagnostics namespace MQTTnet.Diagnostics
{ {
public sealed class MqttNetChildLogger : IMqttNetChildLogger public class MqttNetChildLogger : IMqttNetChildLogger
{ {
private readonly IMqttNetLogger _logger; private readonly IMqttNetLogger _logger;
private readonly string _source; private readonly string _source;
@@ -2,7 +2,7 @@
namespace MQTTnet.Diagnostics namespace MQTTnet.Diagnostics
{ {
public sealed class MqttNetLogMessage public class MqttNetLogMessage
{ {
public MqttNetLogMessage(string logId, DateTime timestamp, int threadId, string source, MqttNetLogLevel level, string message, Exception exception) public MqttNetLogMessage(string logId, DateTime timestamp, int threadId, string source, MqttNetLogLevel level, string message, Exception exception)
{ {
@@ -2,7 +2,7 @@
namespace MQTTnet.Diagnostics namespace MQTTnet.Diagnostics
{ {
public sealed class MqttNetLogMessagePublishedEventArgs : EventArgs public class MqttNetLogMessagePublishedEventArgs : EventArgs
{ {
public MqttNetLogMessagePublishedEventArgs(MqttNetLogMessage logMessage) public MqttNetLogMessagePublishedEventArgs(MqttNetLogMessage logMessage)
{ {
@@ -2,7 +2,7 @@
namespace MQTTnet.Diagnostics namespace MQTTnet.Diagnostics
{ {
public sealed class MqttNetLogger : IMqttNetLogger public class MqttNetLogger : IMqttNetLogger
{ {
private readonly string _logId; private readonly string _logId;
@@ -2,10 +2,14 @@
namespace MQTTnet.Exceptions namespace MQTTnet.Exceptions
{ {
public sealed class MqttCommunicationTimedOutException : MqttCommunicationException public class MqttCommunicationTimedOutException : MqttCommunicationException
{ {
public MqttCommunicationTimedOutException() { } public MqttCommunicationTimedOutException()
public MqttCommunicationTimedOutException(Exception innerException) : base(innerException) { } {
}
public MqttCommunicationTimedOutException(Exception innerException) : base(innerException)
{
}
} }
} }
@@ -2,7 +2,7 @@
namespace MQTTnet.Exceptions namespace MQTTnet.Exceptions
{ {
public sealed class MqttProtocolViolationException : Exception public class MqttProtocolViolationException : Exception
{ {
public MqttProtocolViolationException(string message) public MqttProtocolViolationException(string message)
: base(message) : base(message)
@@ -14,7 +14,7 @@ using MQTTnet.Client;
namespace MQTTnet.Implementations namespace MQTTnet.Implementations
{ {
public sealed class MqttTcpChannel : IMqttChannel public class MqttTcpChannel : IMqttChannel
{ {
// ReSharper disable once MemberCanBePrivate.Global // ReSharper disable once MemberCanBePrivate.Global
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
@@ -13,7 +13,7 @@ using MQTTnet.Client;
namespace MQTTnet.Implementations namespace MQTTnet.Implementations
{ {
public sealed class MqttTcpChannel : IMqttChannel public class MqttTcpChannel : IMqttChannel
{ {
private readonly MqttClientTcpOptions _options; private readonly MqttClientTcpOptions _options;
@@ -8,7 +8,7 @@ using MQTTnet.Client;
namespace MQTTnet.Implementations namespace MQTTnet.Implementations
{ {
public sealed class MqttWebSocketChannel : IMqttChannel public class MqttWebSocketChannel : IMqttChannel
{ {
private readonly SemaphoreSlim _sendLock = new SemaphoreSlim(1, 1); private readonly SemaphoreSlim _sendLock = new SemaphoreSlim(1, 1);
private readonly MqttClientWebSocketOptions _options; private readonly MqttClientWebSocketOptions _options;
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace MQTTnet.Internal namespace MQTTnet.Internal
{ {
// From Stephen Toub (https://blogs.msdn.microsoft.com/pfxteam/2012/02/12/building-async-coordination-primitives-part-6-asynclock/) // From Stephen Toub (https://blogs.msdn.microsoft.com/pfxteam/2012/02/12/building-async-coordination-primitives-part-6-asynclock/)
public sealed class AsyncLock : IDisposable public class AsyncLock : IDisposable
{ {
private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
private readonly Task<IDisposable> _releaser; private readonly Task<IDisposable> _releaser;
@@ -30,7 +30,7 @@ namespace MQTTnet.Internal
_semaphore?.Dispose(); _semaphore?.Dispose();
} }
private sealed class Releaser : IDisposable private class Releaser : IDisposable
{ {
private readonly AsyncLock _toRelease; private readonly AsyncLock _toRelease;
@@ -1,23 +1,9 @@
using System; using MQTTnet.Protocol;
using MQTTnet.Protocol;
namespace MQTTnet namespace MQTTnet
{ {
public sealed class MqttApplicationMessage public class MqttApplicationMessage
{ {
public MqttApplicationMessage()
{
}
[Obsolete("Use object initializer or _MqttApplicationMessageBuilder_ instead.")]
public MqttApplicationMessage(string topic, byte[] payload, MqttQualityOfServiceLevel qualityOfServiceLevel, bool retain)
{
Topic = topic ?? throw new ArgumentNullException(nameof(topic));
Payload = payload ?? throw new ArgumentNullException(nameof(payload));
QualityOfServiceLevel = qualityOfServiceLevel;
Retain = retain;
}
public string Topic { get; set; } public string Topic { get; set; }
public byte[] Payload { get; set; } public byte[] Payload { get; set; }
@@ -2,7 +2,7 @@
namespace MQTTnet namespace MQTTnet
{ {
public sealed class MqttApplicationMessageReceivedEventArgs : EventArgs public class MqttApplicationMessageReceivedEventArgs : EventArgs
{ {
public MqttApplicationMessageReceivedEventArgs(string clientId, MqttApplicationMessage applicationMessage) public MqttApplicationMessageReceivedEventArgs(string clientId, MqttApplicationMessage applicationMessage)
{ {
@@ -2,7 +2,7 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttConnAckPacket : MqttBasePacket public class MqttConnAckPacket : MqttBasePacket
{ {
public bool IsSessionPresent { get; set; } public bool IsSessionPresent { get; set; }
@@ -2,7 +2,7 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttConnectPacket : MqttBasePacket public class MqttConnectPacket : MqttBasePacket
{ {
public MqttProtocolVersion ProtocolVersion { get; set; } public MqttProtocolVersion ProtocolVersion { get; set; }
@@ -1,6 +1,6 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttDisconnectPacket : MqttBasePacket public class MqttDisconnectPacket : MqttBasePacket
{ {
public override string ToString() public override string ToString()
{ {
@@ -1,6 +1,6 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttPingReqPacket : MqttBasePacket public class MqttPingReqPacket : MqttBasePacket
{ {
public override string ToString() public override string ToString()
{ {
@@ -1,6 +1,6 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttPingRespPacket : MqttBasePacket public class MqttPingRespPacket : MqttBasePacket
{ {
public override string ToString() public override string ToString()
{ {
@@ -1,6 +1,6 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttPubAckPacket : MqttBasePublishPacket public class MqttPubAckPacket : MqttBasePublishPacket
{ {
public override string ToString() public override string ToString()
{ {
@@ -1,6 +1,6 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttPubCompPacket : MqttBasePublishPacket public class MqttPubCompPacket : MqttBasePublishPacket
{ {
public override string ToString() public override string ToString()
{ {
@@ -1,6 +1,6 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttPubRecPacket : MqttBasePublishPacket public class MqttPubRecPacket : MqttBasePublishPacket
{ {
public override string ToString() public override string ToString()
{ {
@@ -1,6 +1,6 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttPubRelPacket : MqttBasePublishPacket public class MqttPubRelPacket : MqttBasePublishPacket
{ {
public override string ToString() public override string ToString()
{ {
@@ -2,7 +2,7 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttPublishPacket : MqttBasePublishPacket public class MqttPublishPacket : MqttBasePublishPacket
{ {
public bool Retain { get; set; } public bool Retain { get; set; }
@@ -4,7 +4,7 @@ using MQTTnet.Protocol;
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttSubAckPacket : MqttBasePacket, IMqttPacketWithIdentifier public class MqttSubAckPacket : MqttBasePacket, IMqttPacketWithIdentifier
{ {
public ushort? PacketIdentifier { get; set; } public ushort? PacketIdentifier { get; set; }
@@ -3,7 +3,7 @@ using System.Linq;
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttSubscribePacket : MqttBasePacket, IMqttPacketWithIdentifier public class MqttSubscribePacket : MqttBasePacket, IMqttPacketWithIdentifier
{ {
public ushort? PacketIdentifier { get; set; } public ushort? PacketIdentifier { get; set; }
@@ -1,6 +1,6 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttUnsubAckPacket : MqttBasePacket, IMqttPacketWithIdentifier public class MqttUnsubAckPacket : MqttBasePacket, IMqttPacketWithIdentifier
{ {
public ushort? PacketIdentifier { get; set; } public ushort? PacketIdentifier { get; set; }
@@ -2,7 +2,7 @@
namespace MQTTnet.Packets namespace MQTTnet.Packets
{ {
public sealed class MqttUnsubscribePacket : MqttBasePacket, IMqttPacketWithIdentifier public class MqttUnsubscribePacket : MqttBasePacket, IMqttPacketWithIdentifier
{ {
public ushort? PacketIdentifier { get; set; } public ushort? PacketIdentifier { get; set; }
@@ -2,7 +2,7 @@
namespace MQTTnet.Serializer namespace MQTTnet.Serializer
{ {
public sealed class ByteReader public class ByteReader
{ {
private readonly int _source; private readonly int _source;
private int _index; private int _index;
@@ -2,7 +2,7 @@
namespace MQTTnet.Serializer namespace MQTTnet.Serializer
{ {
public sealed class ByteWriter public class ByteWriter
{ {
private int _index; private int _index;
private int _byte; private int _byte;
@@ -8,7 +8,7 @@ using MQTTnet.Adapter;
namespace MQTTnet.Serializer namespace MQTTnet.Serializer
{ {
public sealed class MqttPacketSerializer : IMqttPacketSerializer public class MqttPacketSerializer : IMqttPacketSerializer
{ {
public MqttProtocolVersion ProtocolVersion { get; set; } = MqttProtocolVersion.V311; public MqttProtocolVersion ProtocolVersion { get; set; } = MqttProtocolVersion.V311;
@@ -1,6 +1,6 @@
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class GetOrCreateClientSessionResult public class GetOrCreateClientSessionResult
{ {
public bool IsExistingSession { get; set; } public bool IsExistingSession { get; set; }
@@ -7,7 +7,7 @@ using MQTTnet.Packets;
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class MqttClientKeepAliveMonitor public class MqttClientKeepAliveMonitor
{ {
private readonly Stopwatch _lastPacketReceivedTracker = new Stopwatch(); private readonly Stopwatch _lastPacketReceivedTracker = new Stopwatch();
private readonly Stopwatch _lastNonKeepAlivePacketReceivedTracker = new Stopwatch(); private readonly Stopwatch _lastNonKeepAlivePacketReceivedTracker = new Stopwatch();
@@ -11,7 +11,7 @@ using MQTTnet.Protocol;
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class MqttClientPendingMessagesQueue : IDisposable public class MqttClientPendingMessagesQueue : IDisposable
{ {
private readonly AsyncAutoResetEvent _queueAutoResetEvent = new AsyncAutoResetEvent(); private readonly AsyncAutoResetEvent _queueAutoResetEvent = new AsyncAutoResetEvent();
private readonly IMqttServerOptions _options; private readonly IMqttServerOptions _options;
@@ -12,7 +12,7 @@ using MQTTnet.Protocol;
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class MqttClientSession : IDisposable public class MqttClientSession : IDisposable
{ {
private readonly MqttPacketIdentifierProvider _packetIdentifierProvider = new MqttPacketIdentifierProvider(); private readonly MqttPacketIdentifierProvider _packetIdentifierProvider = new MqttPacketIdentifierProvider();
@@ -12,7 +12,7 @@ using MQTTnet.Protocol;
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class MqttClientSessionsManager : IDisposable public class MqttClientSessionsManager : IDisposable
{ {
private readonly ConcurrentDictionary<string, MqttClientSession> _sessions = new ConcurrentDictionary<string, MqttClientSession>(); private readonly ConcurrentDictionary<string, MqttClientSession> _sessions = new ConcurrentDictionary<string, MqttClientSession>();
private readonly AsyncLock _sessionPreparationLock = new AsyncLock(); private readonly AsyncLock _sessionPreparationLock = new AsyncLock();
@@ -7,7 +7,7 @@ using MQTTnet.Protocol;
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class MqttClientSubscriptionsManager public class MqttClientSubscriptionsManager
{ {
private readonly ConcurrentDictionary<string, MqttQualityOfServiceLevel> _subscriptions = new ConcurrentDictionary<string, MqttQualityOfServiceLevel>(); private readonly ConcurrentDictionary<string, MqttQualityOfServiceLevel> _subscriptions = new ConcurrentDictionary<string, MqttQualityOfServiceLevel>();
private readonly IMqttServerOptions _options; private readonly IMqttServerOptions _options;
@@ -7,7 +7,7 @@ using MQTTnet.Diagnostics;
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class MqttRetainedMessagesManager public class MqttRetainedMessagesManager
{ {
private readonly ConcurrentDictionary<string, MqttApplicationMessage> _messages = new ConcurrentDictionary<string, MqttApplicationMessage>(); private readonly ConcurrentDictionary<string, MqttApplicationMessage> _messages = new ConcurrentDictionary<string, MqttApplicationMessage>();
private readonly IMqttNetChildLogger _logger; private readonly IMqttNetChildLogger _logger;
@@ -2,7 +2,7 @@
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class MqttServerDefaultEndpointOptions public class MqttServerDefaultEndpointOptions
{ {
public bool IsEnabled { get; set; } = true; public bool IsEnabled { get; set; } = true;
@@ -2,7 +2,7 @@
namespace MQTTnet.Server namespace MQTTnet.Server
{ {
public sealed class MqttServerTlsEndpointOptions public class MqttServerTlsEndpointOptions
{ {
public bool IsEnabled { get; set; } public bool IsEnabled { get; set; }
@@ -2,7 +2,7 @@
namespace MQTTnet namespace MQTTnet
{ {
public sealed class TopicFilter public class TopicFilter
{ {
public TopicFilter(string topic, MqttQualityOfServiceLevel qualityOfServiceLevel) public TopicFilter(string topic, MqttQualityOfServiceLevel qualityOfServiceLevel)
{ {