use the RemoteEndpoint property from the ConnectionContext and added test

This commit is contained in:
JanEggers
2020-04-14 19:16:32 +02:00
parent c10145f743
commit d49a4384c0
4 changed files with 108 additions and 8 deletions
@@ -38,10 +38,9 @@ namespace MQTTnet.AspNetCore
get
{
#if NETCOREAPP3_1
var endpointFeature = Connection.Features.Get<Microsoft.AspNetCore.Connections.Features.IConnectionEndPointFeature>();
if (endpointFeature != null)
if (Connection?.RemoteEndPoint != null)
{
return endpointFeature.RemoteEndPoint.ToString();
return Connection.RemoteEndPoint.ToString();
}
#endif
var connection = Http?.HttpContext?.Connection;