Allow AssignedClientIdentifier in ClientConnected, ClientDisconnected and ConnectedHandler - Fixes chkr1011/MQTTnet#745

This commit is contained in:
Benjamin Crosnier
2019-08-19 10:41:28 +02:00
parent cf6f0ece0e
commit 1a41415dd1
3 changed files with 68 additions and 12 deletions
@@ -240,10 +240,10 @@ namespace MQTTnet.Server
return;
}
clientId = connectPacket.ClientId;
var connectionValidatorContext = await ValidateConnectionAsync(connectPacket, channelAdapter).ConfigureAwait(false);
clientId = connectPacket.ClientId;
if (connectionValidatorContext.ReasonCode != MqttConnectReasonCode.Success)
{
// Send failure response here without preparing a session. The result for a successful connect
@@ -258,7 +258,7 @@ namespace MQTTnet.Server
await _eventDispatcher.HandleClientConnectedAsync(clientId).ConfigureAwait(false);
disconnectType = await connection.RunAsync().ConfigureAwait(false);
disconnectType = await connection.RunAsync(connectionValidatorContext).ConfigureAwait(false);
}
catch (OperationCanceledException)
{