|
@@ -212,7 +212,7 @@ namespace MQTTnet.Server |
|
|
// Switch to the required protocol version before sending any response. |
|
|
// Switch to the required protocol version before sending any response. |
|
|
clientAdapter.PacketSerializer.ProtocolVersion = connectPacket.ProtocolVersion; |
|
|
clientAdapter.PacketSerializer.ProtocolVersion = connectPacket.ProtocolVersion; |
|
|
|
|
|
|
|
|
var connectReturnCode = ValidateConnection(connectPacket); |
|
|
|
|
|
|
|
|
var connectReturnCode = ValidateConnection(connectPacket, clientAdapter); |
|
|
if (connectReturnCode != MqttConnectReturnCode.ConnectionAccepted) |
|
|
if (connectReturnCode != MqttConnectReturnCode.ConnectionAccepted) |
|
|
{ |
|
|
{ |
|
|
await clientAdapter.SendPacketAsync( |
|
|
await clientAdapter.SendPacketAsync( |
|
@@ -268,7 +268,7 @@ namespace MQTTnet.Server |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private MqttConnectReturnCode ValidateConnection(MqttConnectPacket connectPacket) |
|
|
|
|
|
|
|
|
private MqttConnectReturnCode ValidateConnection(MqttConnectPacket connectPacket, IMqttChannelAdapter clientAdapter) |
|
|
{ |
|
|
{ |
|
|
if (_options.ConnectionValidator == null) |
|
|
if (_options.ConnectionValidator == null) |
|
|
{ |
|
|
{ |
|
@@ -279,7 +279,8 @@ namespace MQTTnet.Server |
|
|
connectPacket.ClientId, |
|
|
connectPacket.ClientId, |
|
|
connectPacket.Username, |
|
|
connectPacket.Username, |
|
|
connectPacket.Password, |
|
|
connectPacket.Password, |
|
|
connectPacket.WillMessage); |
|
|
|
|
|
|
|
|
connectPacket.WillMessage, |
|
|
|
|
|
clientAdapter.Endpoint); |
|
|
|
|
|
|
|
|
_options.ConnectionValidator(context); |
|
|
_options.ConnectionValidator(context); |
|
|
return context.ReturnCode; |
|
|
return context.ReturnCode; |
|
|