mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-29 18:02:48 +08:00
Fix MQTTnet.Server connection validation.
This commit is contained in:
@@ -29,10 +29,10 @@ namespace MQTTnet.Server.Mqtt
|
|||||||
{ "client_id", context.ClientId },
|
{ "client_id", context.ClientId },
|
||||||
{ "username", context.Username },
|
{ "username", context.Username },
|
||||||
{ "password", context.Password },
|
{ "password", context.Password },
|
||||||
{ "raw_password", new Bytes(context.RawPassword) },
|
{ "raw_password", new Bytes(context.RawPassword ?? new byte[0]) },
|
||||||
{ "clean_session", context.CleanSession},
|
{ "clean_session", context.CleanSession},
|
||||||
{ "authentication_method", context.AuthenticationMethod},
|
{ "authentication_method", context.AuthenticationMethod},
|
||||||
{ "authentication_data", new Bytes(context.AuthenticationData)},
|
{ "authentication_data", new Bytes(context.AuthenticationData ?? new byte[0]) },
|
||||||
|
|
||||||
{ "result", PythonConvert.Pythonfy(context.ReasonCode) }
|
{ "result", PythonConvert.Pythonfy(context.ReasonCode) }
|
||||||
};
|
};
|
||||||
@@ -44,6 +44,8 @@ namespace MQTTnet.Server.Mqtt
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
_logger.LogError(exception, "Error while validating client connection.");
|
_logger.LogError(exception, "Error while validating client connection.");
|
||||||
|
|
||||||
|
context.ReasonCode = MqttConnectReasonCode.UnspecifiedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|||||||
Reference in New Issue
Block a user