diff --git a/Source/HiveMQtt/Client/Events/BeforeDisconnectEventArgs.cs b/Source/HiveMQtt/Client/Events/BeforeDisconnectEventArgs.cs index 06240826..b43c637b 100644 --- a/Source/HiveMQtt/Client/Events/BeforeDisconnectEventArgs.cs +++ b/Source/HiveMQtt/Client/Events/BeforeDisconnectEventArgs.cs @@ -15,12 +15,9 @@ */ namespace HiveMQtt.Client.Events; -using HiveMQtt.Client.Options; - /// /// Event arguments for the event. /// This event is called before a disconnect is sent to the broker. -/// contains the options of the disconnect operation. /// public class BeforeDisconnectEventArgs : EventArgs { @@ -28,5 +25,4 @@ public BeforeDisconnectEventArgs() { } - public HiveMQClientOptions Options { get; set; } } diff --git a/Source/HiveMQtt/Client/HiveMQClient.cs b/Source/HiveMQtt/Client/HiveMQClient.cs index 2b9d92b5..9855980e 100644 --- a/Source/HiveMQtt/Client/HiveMQClient.cs +++ b/Source/HiveMQtt/Client/HiveMQClient.cs @@ -34,7 +34,7 @@ namespace HiveMQtt.Client; /// public partial class HiveMQClient : IDisposable, IHiveMQClient { - private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger(); private ConnectState connectState = ConnectState.Disconnected; @@ -289,7 +289,7 @@ public async Task SubscribeAsync(SubscribeOptions options) // FIXME: Validate that the packet identifier matches } - catch (System.TimeoutException ex) + catch (TimeoutException ex) { // log.Error(string.Format("Connect timeout. No response received in time.", ex); throw ex; @@ -363,7 +363,7 @@ public async Task UnsubscribeAsync(List subscri // FIXME: Validate that the packet identifier matches } - catch (System.TimeoutException) + catch (TimeoutException) { // log.Error(string.Format("Connect timeout. No response received in time.", ex); throw; diff --git a/Source/HiveMQtt/Client/HiveMQClientEvents.cs b/Source/HiveMQtt/Client/HiveMQClientEvents.cs index d5902615..ed7c5bc8 100644 --- a/Source/HiveMQtt/Client/HiveMQClientEvents.cs +++ b/Source/HiveMQtt/Client/HiveMQClientEvents.cs @@ -38,7 +38,7 @@ public partial class HiveMQClient : IDisposable, IHiveMQClient protected virtual void BeforeConnectEventLauncher(HiveMQClientOptions options) { var eventArgs = new BeforeConnectEventArgs(options); - logger.Trace("BeforeConnectEventLauncher"); + Logger.Trace("BeforeConnectEventLauncher"); this.BeforeConnect?.Invoke(this, eventArgs); } @@ -50,7 +50,7 @@ protected virtual void BeforeConnectEventLauncher(HiveMQClientOptions options) protected virtual void AfterConnectEventLauncher(ConnectResult results) { var eventArgs = new AfterConnectEventArgs(results); - logger.Trace("AfterConnectEventLauncher"); + Logger.Trace("AfterConnectEventLauncher"); this.AfterConnect?.Invoke(this, eventArgs); } @@ -62,7 +62,7 @@ protected virtual void AfterConnectEventLauncher(ConnectResult results) protected virtual void BeforeDisconnectEventLauncher() { var eventArgs = new BeforeDisconnectEventArgs(); - logger.Trace("BeforeDisconnectEventLauncher"); + Logger.Trace("BeforeDisconnectEventLauncher"); this.BeforeDisconnect?.Invoke(this, eventArgs); } @@ -74,7 +74,7 @@ protected virtual void BeforeDisconnectEventLauncher() protected virtual void AfterDisconnectEventLauncher(bool clean = false) { var eventArgs = new AfterDisconnectEventArgs(clean); - logger.Trace("AfterDisconnectEventLauncher"); + Logger.Trace("AfterDisconnectEventLauncher"); this.AfterDisconnect?.Invoke(this, eventArgs); } @@ -86,7 +86,7 @@ protected virtual void AfterDisconnectEventLauncher(bool clean = false) protected virtual void BeforeSubscribeEventLauncher(SubscribeOptions options) { var eventArgs = new BeforeSubscribeEventArgs(options); - logger.Trace("BeforeSubscribeEventLauncher"); + Logger.Trace("BeforeSubscribeEventLauncher"); this.BeforeSubscribe?.Invoke(this, eventArgs); } @@ -98,7 +98,7 @@ protected virtual void BeforeSubscribeEventLauncher(SubscribeOptions options) protected virtual void AfterSubscribeEventLauncher(SubscribeResult results) { var eventArgs = new AfterSubscribeEventArgs(results); - logger.Trace("AfterSubscribeEventLauncher"); + Logger.Trace("AfterSubscribeEventLauncher"); this.AfterSubscribe?.Invoke(this, eventArgs); } @@ -110,7 +110,7 @@ protected virtual void AfterSubscribeEventLauncher(SubscribeResult results) protected virtual void BeforeUnsubscribeEventLauncher(List subscriptions) { var eventArgs = new BeforeUnsubscribeEventArgs(subscriptions); - logger.Trace("BeforeUnsubscribeEventLauncher"); + Logger.Trace("BeforeUnsubscribeEventLauncher"); this.BeforeUnsubscribe?.Invoke(this, eventArgs); } @@ -122,7 +122,7 @@ protected virtual void BeforeUnsubscribeEventLauncher(List subscri protected virtual void AfterUnsubscribeEventLauncher(UnsubscribeResult results) { var eventArgs = new AfterUnsubscribeEventArgs(results); - logger.Trace("AfterUnsubscribeEventLauncher"); + Logger.Trace("AfterUnsubscribeEventLauncher"); this.AfterUnsubscribe?.Invoke(this, eventArgs); } @@ -134,7 +134,7 @@ protected virtual void AfterUnsubscribeEventLauncher(UnsubscribeResult results) protected virtual void OnMessageReceivedEventLauncher(PublishPacket packet) { var eventArgs = new OnMessageReceivedEventArgs(packet.Message); - logger.Trace("OnMessageReceivedEventLauncher"); + Logger.Trace("OnMessageReceivedEventLauncher"); this.OnMessageReceived?.Invoke(this, eventArgs); } @@ -150,7 +150,7 @@ protected virtual void OnMessageReceivedEventLauncher(PublishPacket packet) protected virtual void OnConnectSentEventLauncher(ConnectPacket packet) { var eventArgs = new OnConnectSentEventArgs(packet); - logger.Trace("OnConnectSentEventLauncher"); + Logger.Trace("OnConnectSentEventLauncher"); this.OnConnectSent?.Invoke(this, eventArgs); } @@ -162,7 +162,7 @@ protected virtual void OnConnectSentEventLauncher(ConnectPacket packet) protected virtual void OnConnAckReceivedEventLauncher(ConnAckPacket packet) { var eventArgs = new OnConnAckReceivedEventArgs(packet); - logger.Trace("OnConnAckReceivedEventLauncher"); + Logger.Trace("OnConnAckReceivedEventLauncher"); this.OnConnAckReceived?.Invoke(this, eventArgs); } @@ -174,7 +174,7 @@ protected virtual void OnConnAckReceivedEventLauncher(ConnAckPacket packet) protected virtual void OnDisconnectSentEventLauncher(DisconnectPacket packet) { var eventArgs = new OnDisconnectSentEventArgs(packet); - logger.Trace("OnDisconnectSentEventLauncher"); + Logger.Trace("OnDisconnectSentEventLauncher"); this.OnDisconnectSent?.Invoke(this, eventArgs); } @@ -186,7 +186,7 @@ protected virtual void OnDisconnectSentEventLauncher(DisconnectPacket packet) protected virtual void OnDisconnectReceivedEventLauncher(DisconnectPacket packet) { var eventArgs = new OnDisconnectReceivedEventArgs(packet); - logger.Trace("OnDisconnectReceivedEventLauncher: ReasonCode: " + packet.DisconnectReasonCode + " ReasonString: " + packet.Properties.ReasonString); + Logger.Trace("OnDisconnectReceivedEventLauncher: ReasonCode: " + packet.DisconnectReasonCode + " ReasonString: " + packet.Properties.ReasonString); this.OnDisconnectReceived?.Invoke(this, eventArgs); } @@ -198,7 +198,7 @@ protected virtual void OnDisconnectReceivedEventLauncher(DisconnectPacket packet protected virtual void OnPingReqSentEventLauncher(PingReqPacket packet) { var eventArgs = new OnPingReqSentEventArgs(packet); - logger.Trace("OnPingReqSentEventLauncher"); + Logger.Trace("OnPingReqSentEventLauncher"); this.OnPingReqSent?.Invoke(this, eventArgs); } @@ -210,7 +210,7 @@ protected virtual void OnPingReqSentEventLauncher(PingReqPacket packet) protected virtual void OnPingRespReceivedEventLauncher(PingRespPacket packet) { var eventArgs = new OnPingRespReceivedEventArgs(packet); - logger.Trace("OnPingRespReceivedEventLauncher"); + Logger.Trace("OnPingRespReceivedEventLauncher"); this.OnPingRespReceived?.Invoke(this, eventArgs); } @@ -222,7 +222,7 @@ protected virtual void OnPingRespReceivedEventLauncher(PingRespPacket packet) protected virtual void OnSubscribeSentEventLauncher(SubscribePacket packet) { var eventArgs = new OnSubscribeSentEventArgs(packet); - logger.Trace("OnSubscribeSentEventLauncher"); + Logger.Trace("OnSubscribeSentEventLauncher"); this.OnSubscribeSent?.Invoke(this, eventArgs); } @@ -234,7 +234,7 @@ protected virtual void OnSubscribeSentEventLauncher(SubscribePacket packet) protected virtual void OnSubAckReceivedEventLauncher(SubAckPacket packet) { var eventArgs = new OnSubAckReceivedEventArgs(packet); - logger.Trace("OnSubAckReceivedEventLauncher"); + Logger.Trace("OnSubAckReceivedEventLauncher"); this.OnSubAckReceived?.Invoke(this, eventArgs); } @@ -246,7 +246,7 @@ protected virtual void OnSubAckReceivedEventLauncher(SubAckPacket packet) protected virtual void OnUnsubscribeSentEventLauncher(UnsubscribePacket packet) { var eventArgs = new OnUnsubscribeSentEventArgs(packet); - logger.Trace("OnUnsubscribeSentEventLauncher"); + Logger.Trace("OnUnsubscribeSentEventLauncher"); this.OnUnsubscribeSent?.Invoke(this, eventArgs); } @@ -258,7 +258,7 @@ protected virtual void OnUnsubscribeSentEventLauncher(UnsubscribePacket packet) protected virtual void OnUnsubAckReceivedEventLauncher(UnsubAckPacket packet) { var eventArgs = new OnUnsubAckReceivedEventArgs(packet); - logger.Trace("OnUnsubAckReceivedEventLauncher"); + Logger.Trace("OnUnsubAckReceivedEventLauncher"); this.OnUnsubAckReceived?.Invoke(this, eventArgs); } @@ -270,7 +270,7 @@ protected virtual void OnUnsubAckReceivedEventLauncher(UnsubAckPacket packet) protected virtual void OnPublishReceivedEventLauncher(PublishPacket packet) { var eventArgs = new OnPublishReceivedEventArgs(packet); - logger.Trace("OnPublishReceivedEventLauncher"); + Logger.Trace("OnPublishReceivedEventLauncher"); this.OnPublishReceived?.Invoke(this, eventArgs); } @@ -282,7 +282,7 @@ protected virtual void OnPublishReceivedEventLauncher(PublishPacket packet) protected virtual void OnPublishSentEventLauncher(PublishPacket packet) { var eventArgs = new OnPublishSentEventArgs(packet); - logger.Trace("OnPublishSentEventLauncher"); + Logger.Trace("OnPublishSentEventLauncher"); this.OnPublishSent?.Invoke(this, eventArgs); } @@ -294,7 +294,7 @@ protected virtual void OnPublishSentEventLauncher(PublishPacket packet) protected virtual void OnPubAckReceivedEventLauncher(PubAckPacket packet) { var eventArgs = new OnPubAckReceivedEventArgs(packet); - logger.Trace("OnPubAckReceivedEventLauncher"); + Logger.Trace("OnPubAckReceivedEventLauncher"); this.OnPubAckReceived?.Invoke(this, eventArgs); } @@ -306,7 +306,7 @@ protected virtual void OnPubAckReceivedEventLauncher(PubAckPacket packet) protected virtual void OnPubAckSentEventLauncher(PubAckPacket packet) { var eventArgs = new OnPubAckSentEventArgs(packet); - logger.Trace("OnPubAckSentEventLauncher"); + Logger.Trace("OnPubAckSentEventLauncher"); this.OnPubAckSent?.Invoke(this, eventArgs); } @@ -318,7 +318,7 @@ protected virtual void OnPubAckSentEventLauncher(PubAckPacket packet) protected virtual void OnPubRecReceivedEventLauncher(PubRecPacket packet) { var eventArgs = new OnPubRecReceivedEventArgs(packet); - logger.Trace("OnPubRecReceivedEventLauncher"); + Logger.Trace("OnPubRecReceivedEventLauncher"); this.OnPubRecReceived?.Invoke(this, eventArgs); } @@ -330,7 +330,7 @@ protected virtual void OnPubRecReceivedEventLauncher(PubRecPacket packet) protected virtual void OnPubRecSentEventLauncher(PubRecPacket packet) { var eventArgs = new OnPubRecSentEventArgs(packet); - logger.Trace("OnPubRecSentEventLauncher"); + Logger.Trace("OnPubRecSentEventLauncher"); this.OnPubRecSent?.Invoke(this, eventArgs); } @@ -342,7 +342,7 @@ protected virtual void OnPubRecSentEventLauncher(PubRecPacket packet) protected virtual void OnPubRelReceivedEventLauncher(PubRelPacket packet) { var eventArgs = new OnPubRelReceivedEventArgs(packet); - logger.Trace("OnPubRelReceivedEventLauncher"); + Logger.Trace("OnPubRelReceivedEventLauncher"); this.OnPubRelReceived?.Invoke(this, eventArgs); } @@ -354,7 +354,7 @@ protected virtual void OnPubRelReceivedEventLauncher(PubRelPacket packet) protected virtual void OnPubRelSentEventLauncher(PubRelPacket packet) { var eventArgs = new OnPubRelSentEventArgs(packet); - logger.Trace("OnPubRelSentEventLauncher"); + Logger.Trace("OnPubRelSentEventLauncher"); this.OnPubRelSent?.Invoke(this, eventArgs); } @@ -366,7 +366,7 @@ protected virtual void OnPubRelSentEventLauncher(PubRelPacket packet) protected virtual void OnPubCompReceivedEventLauncher(PubCompPacket packet) { var eventArgs = new OnPubCompReceivedEventArgs(packet); - logger.Trace("PubCompReceivedEventLauncher"); + Logger.Trace("PubCompReceivedEventLauncher"); this.OnPubCompReceived?.Invoke(this, eventArgs); } @@ -378,7 +378,7 @@ protected virtual void OnPubCompReceivedEventLauncher(PubCompPacket packet) protected virtual void OnPubCompSentEventLauncher(PubCompPacket packet) { var eventArgs = new OnPubCompSentEventArgs(packet); - logger.Trace("PubCompSentEventLauncher"); + Logger.Trace("PubCompSentEventLauncher"); this.OnPubCompSent?.Invoke(this, eventArgs); } } diff --git a/Source/HiveMQtt/Client/HiveMQClientSocket.cs b/Source/HiveMQtt/Client/HiveMQClientSocket.cs index 318a5757..d3ec55df 100644 --- a/Source/HiveMQtt/Client/HiveMQClientSocket.cs +++ b/Source/HiveMQtt/Client/HiveMQClientSocket.cs @@ -139,7 +139,7 @@ internal async Task ConnectSocketAsync() _ = this.TrafficOutflowProcessorAsync(this.outFlowCancellationToken); _ = this.TrafficInflowProcessorAsync(this.infoFlowCancellationToken); - logger.Trace($"Socket connected to {this.socket.RemoteEndPoint}"); + Logger.Trace($"Socket connected to {this.socket.RemoteEndPoint}"); return socketConnected; } diff --git a/Source/HiveMQtt/Client/HiveMQClientTrafficProcessor.cs b/Source/HiveMQtt/Client/HiveMQClientTrafficProcessor.cs index 82b3051f..c985db44 100644 --- a/Source/HiveMQtt/Client/HiveMQClientTrafficProcessor.cs +++ b/Source/HiveMQtt/Client/HiveMQClientTrafficProcessor.cs @@ -47,7 +47,7 @@ private Task TrafficOutflowProcessorAsync(CancellationToken cancellationTo stopWatch.Start(); - logger.Trace($"{Environment.CurrentManagedThreadId}: TrafficOutflowProcessor Starting...{this.connectState}"); + Logger.Trace($"{Environment.CurrentManagedThreadId}: TrafficOutflowProcessor Starting...{this.connectState}"); while (this.connectState != ConnectState.Disconnected) { @@ -56,7 +56,7 @@ private Task TrafficOutflowProcessorAsync(CancellationToken cancellationTo if (elapsed > TimeSpan.FromSeconds(keepAlivePeriod)) { // Send PingReq - logger.Trace("--> PingReq"); + Logger.Trace("--> PingReq"); var writeResult = await this.WriteAsync(PingReqPacket.Encode()).ConfigureAwait(false); this.OnPingReqSentEventLauncher(new PingReqPacket()); stopWatch.Restart(); @@ -83,27 +83,27 @@ private Task TrafficOutflowProcessorAsync(CancellationToken cancellationTo { // FIXME: Only one connect, subscribe or unsubscribe packet can be sent at a time. case ConnectPacket connectPacket: - logger.Trace("--> ConnectPacket"); + Logger.Trace("--> ConnectPacket"); writeResult = await this.WriteAsync(connectPacket.Encode()).ConfigureAwait(false); this.OnConnectSentEventLauncher(connectPacket); break; case DisconnectPacket disconnectPacket: - logger.Trace("--> DisconnectPacket"); + Logger.Trace("--> DisconnectPacket"); writeResult = await this.WriteAsync(disconnectPacket.Encode()).ConfigureAwait(false); this.OnDisconnectSentEventLauncher(disconnectPacket); break; case SubscribePacket subscribePacket: - logger.Trace("--> SubscribePacket"); + Logger.Trace("--> SubscribePacket"); writeResult = await this.WriteAsync(subscribePacket.Encode()).ConfigureAwait(false); this.OnSubscribeSentEventLauncher(subscribePacket); break; case UnsubscribePacket unsubscribePacket: - logger.Trace("--> UnsubscribePacket"); + Logger.Trace("--> UnsubscribePacket"); writeResult = await this.WriteAsync(unsubscribePacket.Encode()).ConfigureAwait(false); this.OnUnsubscribeSentEventLauncher(unsubscribePacket); break; case PublishPacket publishPacket: - logger.Trace("--> PublishPacket"); + Logger.Trace("--> PublishPacket"); if (publishPacket.Message.QoS is MQTT5.Types.QualityOfService.AtLeastOnceDelivery || publishPacket.Message.QoS is MQTT5.Types.QualityOfService.ExactlyOnceDelivery) { @@ -121,28 +121,28 @@ private Task TrafficOutflowProcessorAsync(CancellationToken cancellationTo case PubAckPacket pubAckPacket: // This is in response to a received Publish packet. Communication chain management // was done in the receiver code. Just send the response. - logger.Trace("--> PubAckPacket"); + Logger.Trace("--> PubAckPacket"); writeResult = await this.WriteAsync(pubAckPacket.Encode()).ConfigureAwait(false); this.OnPubAckSentEventLauncher(pubAckPacket); break; case PubRecPacket pubRecPacket: // This is in response to a received Publish packet. Communication chain management // was done in the receiver code. Just send the response. - logger.Trace("--> PubRecPacket"); + Logger.Trace("--> PubRecPacket"); writeResult = await this.WriteAsync(pubRecPacket.Encode()).ConfigureAwait(false); this.OnPubRecSentEventLauncher(pubRecPacket); break; case PubRelPacket pubRelPacket: // This is in response to a received PubRec packet. Communication chain management // was done in the receiver code. Just send the response. - logger.Trace("--> PubRelPacket"); + Logger.Trace("--> PubRelPacket"); writeResult = await this.WriteAsync(pubRelPacket.Encode()).ConfigureAwait(false); this.OnPubRelSentEventLauncher(pubRelPacket); break; case PubCompPacket pubCompPacket: // This is in response to a received PubRel packet. Communication chain management // was done in the receiver code. Just send the response. - logger.Trace("--> PubCompPacket"); + Logger.Trace("--> PubCompPacket"); writeResult = await this.WriteAsync(pubCompPacket.Encode()).ConfigureAwait(false); this.OnPubCompSentEventLauncher(pubCompPacket); break; @@ -154,19 +154,19 @@ private Task TrafficOutflowProcessorAsync(CancellationToken cancellationTo */ default: - logger.Trace("--> Unknown packet type"); + Logger.Trace("--> Unknown packet type"); throw new NotImplementedException(); } if (writeResult.IsCanceled) { - logger.Trace("TrafficOutflowProcessor Write Canceled"); + Logger.Trace("TrafficOutflowProcessor Write Canceled"); break; } if (writeResult.IsCompleted) { - logger.Trace("TrafficOutflowProcessor IsCompleted: end of the stream"); + Logger.Trace("TrafficOutflowProcessor IsCompleted: end of the stream"); break; } @@ -174,7 +174,7 @@ private Task TrafficOutflowProcessorAsync(CancellationToken cancellationTo } } // while - logger.Trace($"{Environment.CurrentManagedThreadId}: TrafficOutflowProcessor Exiting...{this.connectState}"); + Logger.Trace($"{Environment.CurrentManagedThreadId}: TrafficOutflowProcessor Exiting...{this.connectState}"); return true; }, cancellationToken); @@ -184,7 +184,7 @@ private Task TrafficOutflowProcessorAsync(CancellationToken cancellationTo private Task TrafficInflowProcessorAsync(CancellationToken cancellationToken) => Task.Run( async () => { - logger.Trace($"{Environment.CurrentManagedThreadId}: TrafficInflowProcessor Starting...{this.connectState}"); + Logger.Trace($"{Environment.CurrentManagedThreadId}: TrafficInflowProcessor Starting...{this.connectState}"); ReadResult readResult; @@ -192,7 +192,7 @@ private Task TrafficInflowProcessorAsync(CancellationToken cancellationTok { if (cancellationToken.IsCancellationRequested) { - logger.Trace("TrafficInflowProcessor Canceled"); + Logger.Trace("TrafficInflowProcessor Canceled"); break; } @@ -200,18 +200,18 @@ private Task TrafficInflowProcessorAsync(CancellationToken cancellationTok if (readResult.IsCanceled) { - logger.Trace("TrafficInflowProcessor Read Canceled"); + Logger.Trace("TrafficInflowProcessor Read Canceled"); break; } if (readResult.IsCompleted) { // This is an unexpected exit and may be due to a network failure. - logger.Trace("TrafficInflowProcessor IsCompleted: end of the streamx"); + Logger.Trace("TrafficInflowProcessor IsCompleted: end of the streamx"); if (this.connectState == ConnectState.Connected) { - logger.Trace("TrafficInflowProcessor IsCompleted: was unexpected"); + Logger.Trace("TrafficInflowProcessor IsCompleted: was unexpected"); this.connectState = ConnectState.Disconnected; // Launch the AfterDisconnect event with a clean disconnect set to false. @@ -225,7 +225,7 @@ private Task TrafficInflowProcessorAsync(CancellationToken cancellationTok if (readResult.Buffer.IsEmpty) { - logger.Trace("TrafficInflowProcessor Read Buffer Empty"); + Logger.Trace("TrafficInflowProcessor Read Buffer Empty"); continue; } @@ -238,7 +238,7 @@ private Task TrafficInflowProcessorAsync(CancellationToken cancellationTok } catch (Exception ex) { - logger.Trace($"TrafficInflowProcessor Decoding Exception: {ex.Message}"); + Logger.Trace($"TrafficInflowProcessor Decoding Exception: {ex.Message}"); throw; } @@ -248,7 +248,7 @@ private Task TrafficInflowProcessorAsync(CancellationToken cancellationTok } else if (packet is MalformedPacket) { - logger.Trace("TrafficInflowProcessor Malformed Packet Detected !!! Skipping..."); + Logger.Trace("TrafficInflowProcessor Malformed Packet Detected !!! Skipping..."); this.reader?.AdvanceTo(consumed); continue; } @@ -259,23 +259,23 @@ private Task TrafficInflowProcessorAsync(CancellationToken cancellationTok switch (packet) { case ConnAckPacket connAckPacket: - logger.Trace("<-- ConnAck"); + Logger.Trace("<-- ConnAck"); this.OnConnAckReceivedEventLauncher(connAckPacket); break; case DisconnectPacket disconnectPacket: - logger.Trace("<-- Disconnect"); + Logger.Trace("<-- Disconnect"); this.OnDisconnectReceivedEventLauncher(disconnectPacket); break; case PingRespPacket pingRespPacket: - logger.Trace("<-- PingResp"); + Logger.Trace("<-- PingResp"); this.OnPingRespReceivedEventLauncher(pingRespPacket); break; case SubAckPacket subAckPacket: - logger.Trace("<-- SubAck"); + Logger.Trace("<-- SubAck"); this.OnSubAckReceivedEventLauncher(subAckPacket); break; case UnsubAckPacket unsubAckPacket: - logger.Trace("<-- UnsubAck"); + Logger.Trace("<-- UnsubAck"); this.OnUnsubAckReceivedEventLauncher(unsubAckPacket); break; case PublishPacket publishPacket: @@ -294,13 +294,13 @@ private Task TrafficInflowProcessorAsync(CancellationToken cancellationTok this.HandleIncomingPubCompPacket(pubCompPacket); break; default: - logger.Trace("<-- Unknown"); + Logger.Trace("<-- Unknown"); Console.WriteLine($"Unknown packet received: {packet}"); break; } // switch (packet) } // while - logger.Trace($"{Environment.CurrentManagedThreadId}: TrafficInflowProcessor Exiting...{this.connectState}"); + Logger.Trace($"{Environment.CurrentManagedThreadId}: TrafficInflowProcessor Exiting...{this.connectState}"); return true; }, cancellationToken); @@ -311,7 +311,7 @@ private Task TrafficInflowProcessorAsync(CancellationToken cancellationTok /// internal void HandleIncomingPublishPacket(PublishPacket publishPacket) { - logger.Trace("<-- Publish"); + Logger.Trace("<-- Publish"); if (publishPacket.Message.QoS is MQTT5.Types.QualityOfService.AtLeastOnceDelivery) { // We've received a QoS 1 publish. Send a PubAck. @@ -343,7 +343,7 @@ internal void HandleIncomingPublishPacket(PublishPacket publishPacket) /// internal void HandleIncomingPubAckPacket(PubAckPacket pubAckPacket) { - logger.Trace("<-- PubAck"); + Logger.Trace("<-- PubAck"); if (this.transactionQueue.Remove(pubAckPacket.PacketIdentifier, out var publishQoS1Chain)) { var publishPacket = (PublishPacket)publishQoS1Chain.First(); @@ -365,7 +365,7 @@ internal void HandleIncomingPubAckPacket(PubAckPacket pubAckPacket) /// internal void HandleIncomingPubRecPacket(PubRecPacket pubRecPacket) { - logger.Trace("<-- PubRec"); + Logger.Trace("<-- PubRec"); PubRelPacket pubRelResponsePacket; if (this.transactionQueue.TryGetValue(pubRecPacket.PacketIdentifier, out var publishQoS2Chain)) { @@ -397,7 +397,7 @@ internal void HandleIncomingPubRecPacket(PubRecPacket pubRecPacket) /// internal void HandleIncomingPubRelPacket(PubRelPacket pubRelPacket) { - logger.Trace("<-- PubRel"); + Logger.Trace("<-- PubRel"); PubCompPacket pubCompResponsePacket; if (this.transactionQueue.TryGetValue(pubRelPacket.PacketIdentifier, out var pubRelQoS2Chain)) { @@ -421,7 +421,7 @@ internal void HandleIncomingPubRelPacket(PubRelPacket pubRelPacket) /// internal void HandleIncomingPubCompPacket(PubCompPacket pubCompPacket) { - logger.Trace("<-- PubComp"); + Logger.Trace("<-- PubComp"); if (!this.transactionQueue.Remove(pubCompPacket.PacketIdentifier, out var pubcompQoS2Chain)) { throw new HiveMQttClientException("Received PubComp with an unknown packet identifier: ¯\\_(ツ)_/¯"); diff --git a/Source/HiveMQtt/HiveMQtt.csproj b/Source/HiveMQtt/HiveMQtt.csproj index 7beacfc2..bef2fe03 100644 --- a/Source/HiveMQtt/HiveMQtt.csproj +++ b/Source/HiveMQtt/HiveMQtt.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 HiveMQtt HiveMQ MQTT Client that is a MQTT 5.0 compatible C# client library.