浏览代码

Merge pull request #884 from chkr1011/feature-isconnected

Added check if the server is started or not.
release/3.x.x
Christian 4 年前
committed by GitHub
父节点
当前提交
aafc99f39e
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 3 个文件被更改,包括 5 次插入0 次删除
  1. +1
    -0
      Build/MQTTnet.nuspec
  2. +2
    -0
      Source/MQTTnet/Server/IMqttServer.cs
  3. +2
    -0
      Source/MQTTnet/Server/MqttServer.cs

+ 1
- 0
Build/MQTTnet.nuspec 查看文件

@@ -26,6 +26,7 @@
* [Server] Added interceptor for unsubscriptions.
* [Server] Removed exceptions when user properties are set with MQTT protocol version 3.1
* [Server] Added custom session items to the client status.
* [Server] Added option to check whether the server is already started properly or not.
* [MQTTnet.AspNetCore] improved compatibility with AspNetCore 3.1
* [MQTTnet.Server] Added interceptor for unsubscriptions.
</releaseNotes>


+ 2
- 0
Source/MQTTnet/Server/IMqttServer.cs 查看文件

@@ -27,5 +27,7 @@ namespace MQTTnet.Server

Task StartAsync(IMqttServerOptions options);
Task StopAsync();

bool IsStarted { get; }
}
}

+ 2
- 0
Source/MQTTnet/Server/MqttServer.cs 查看文件

@@ -190,6 +190,8 @@ namespace MQTTnet.Server
return _retainedMessagesManager?.ClearMessagesAsync();
}

public bool IsStarted => _cancellationTokenSource != null;

private Task OnHandleClient(IMqttChannelAdapter channelAdapter)
{
return _clientSessionsManager.HandleClientConnectionAsync(channelAdapter);


正在加载...
取消
保存