소스 검색

Fix a bug where an incoming SSL client connection was being treated as a plain-text connection.

release/3.x.x
Andrew 6 년 전
부모
커밋
dddc1ec112
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. +4
    -2
      Source/MQTTnet/Implementations/MqttTcpServerListener.cs

+ 4
- 2
Source/MQTTnet/Implementations/MqttTcpServerListener.cs 파일 보기

@@ -70,15 +70,17 @@ namespace MQTTnet.Implementations
#endif
clientSocket.NoDelay = true;

SslStream sslStream = null;

if (_tlsCertificate != null)
{
var sslStream = new SslStream(new NetworkStream(clientSocket), false);
sslStream = new SslStream(new NetworkStream(clientSocket), false);
await sslStream.AuthenticateAsServerAsync(_tlsCertificate, false, SslProtocols.Tls12, false).ConfigureAwait(false);
}

_logger.Verbose($"Client '{clientSocket.RemoteEndPoint}' accepted by TCP listener '{_socket.LocalEndPoint}, {_addressFamily}'.");

var clientAdapter = new MqttChannelAdapter(new MqttTcpChannel(clientSocket, null), new MqttPacketSerializer(), _logger);
var clientAdapter = new MqttChannelAdapter(new MqttTcpChannel(clientSocket, sslStream), new MqttPacketSerializer(), _logger);
ClientAccepted?.Invoke(this, new MqttServerAdapterClientAcceptedEventArgs(clientAdapter));
}
catch (ObjectDisposedException)


불러오는 중...
취소
저장