add resources
add worker fix process logic
This commit is contained in:
@@ -7,6 +7,7 @@ using Best.MQTT.Packets.Utils;
|
||||
using Best.MQTT.Transports;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -295,12 +296,14 @@ namespace Best.MQTT
|
||||
throw new ArgumentNullException(nameof(topicName));
|
||||
|
||||
if (this.State != ClientStates.Connected)
|
||||
throw new Exception("Can add an alias only when connected!");
|
||||
throw new Exception($"{topicName} Can add an alias only when connected!");
|
||||
|
||||
UInt16 aliases = this.Session.ClientTopicAliasMapping.Count();
|
||||
if (aliases >= this.NegotiatedOptions.ServerOptions.TopicAliasMaximum)
|
||||
throw new Exception($"Can't add more alias, already reached the server's Topic Alias Maximum setting ({this.NegotiatedOptions.ServerOptions.TopicAliasMaximum})!");
|
||||
|
||||
|
||||
|
||||
this.Session.ClientTopicAliasMapping.Add(topicName, this.NegotiatedOptions.ServerOptions.TopicAliasMaximum);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user