improved api surface of mqttserver and fixed unittests

This commit is contained in:
JanEggers
2017-10-02 22:55:56 +02:00
parent 3079ad37ce
commit 1d78d675f7
9 changed files with 90 additions and 181 deletions
+1 -9
View File
@@ -27,7 +27,7 @@ namespace MQTTnet.Core.Server
_clientSessionsManager.ClientDisconnected += OnClientDisconnected;
}
public IList<ConnectedMqttClient> GetConnectedClients()
public IReadOnlyList<ConnectedMqttClient> GetConnectedClients()
{
return _clientSessionsManager.GetConnectedClients();
}
@@ -43,14 +43,6 @@ namespace MQTTnet.Core.Server
_clientSessionsManager.DispatchPublishPacket(null, applicationMessage.ToPublishPacket());
}
public void InjectClient(IMqttCommunicationAdapter adapter)
{
if (adapter == null) throw new ArgumentNullException(nameof(adapter));
if (_cancellationTokenSource == null) throw new InvalidOperationException("The MQTT server is not started.");
OnClientAccepted(adapter);
}
public async Task StartAsync()
{
if (_cancellationTokenSource != null) throw new InvalidOperationException("The MQTT server is already started.");