Parcourir la source

Fixes chkr1011's refactoing and pass all tests

release/3.x.x
Sébastien Warin il y a 6 ans
Parent
révision
932aa1fd39
2 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. +4
    -2
      Frameworks/MQTTnet.NetStandard/Server/MqttClientSessionsManager.cs
  2. +1
    -1
      Frameworks/MQTTnet.NetStandard/Server/MqttRetainedMessagesManager.cs

+ 4
- 2
Frameworks/MQTTnet.NetStandard/Server/MqttClientSessionsManager.cs Voir le fichier

@@ -136,9 +136,9 @@ namespace MQTTnet.Server
return Task.FromResult((IList<IMqttClientSessionStatus>)result);
}

public void StartDispatchApplicationMessage(MqttClientSession senderClientSession, MqttApplicationMessage applicationMessage)
public Task StartDispatchApplicationMessage(MqttClientSession senderClientSession, MqttApplicationMessage applicationMessage)
{
Task.Run(() => DispatchApplicationMessageAsync(senderClientSession, applicationMessage));
return DispatchApplicationMessageAsync(senderClientSession, applicationMessage);
}

public Task SubscribeAsync(string clientId, IList<TopicFilter> topicFilters)
@@ -237,6 +237,7 @@ namespace MQTTnet.Server
{
try
{
_logger.Verbose($"DispatchApplicationMessageAsync");
var interceptorContext = InterceptApplicationMessage(senderClientSession, applicationMessage);
if (interceptorContext.CloseConnection)
{
@@ -257,6 +258,7 @@ namespace MQTTnet.Server

foreach (var clientSession in _sessions.Values)
{
_logger.Verbose($"DispatchApplicationMessageAsync for {clientSession.ClientId} ");
clientSession.EnqueueApplicationMessage(applicationMessage);
}
}


+ 1
- 1
Frameworks/MQTTnet.NetStandard/Server/MqttRetainedMessagesManager.cs Voir le fichier

@@ -82,7 +82,7 @@ namespace MQTTnet.Server
{
var saveIsRequired = false;

if (applicationMessage.Payload?.Length > 0)
if (applicationMessage.Payload?.Length == 0)
{
saveIsRequired = _messages.TryRemove(applicationMessage.Topic, out _);
_logger.Info("Client '{0}' cleared retained message for topic '{1}'.", clientId, applicationMessage.Topic);


Chargement…
Annuler
Enregistrer