add resources

add worker
fix process logic
This commit is contained in:
lwj
2025-06-26 15:55:03 +09:00
parent 0f94e89de7
commit e855f49513
52 changed files with 2703 additions and 166 deletions

View File

@@ -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);
}