Fix scope id test failures on mac and linux (#1754)
This commit is contained in:
parent
39047638cc
commit
f26c31c116
|
|
@ -93,7 +93,20 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin
|
|||
*((long*)(b + 8)) = _field2;
|
||||
}
|
||||
|
||||
return new IPEndPoint(new IPAddress(bytes, scopeid: _field3 & 0xFFFFFFFF), port);
|
||||
return new IPEndPoint(new IPAddress(bytes, ScopeId), port);
|
||||
}
|
||||
}
|
||||
|
||||
public uint ScopeId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (uint)_field3;
|
||||
}
|
||||
set
|
||||
{
|
||||
_field3 &= unchecked ((long)0xFFFFFFFF00000000);
|
||||
_field3 |= value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin
|
|||
{
|
||||
throw error1;
|
||||
}
|
||||
|
||||
if (endPoint.Address.ScopeId != addr.ScopeId)
|
||||
{
|
||||
// IPAddress.ScopeId cannot be less than 0 or greater than 0xFFFFFFFF
|
||||
// https://msdn.microsoft.com/en-us/library/system.net.ipaddress.scopeid(v=vs.110).aspx
|
||||
addr.ScopeId = (uint)endPoint.Address.ScopeId;
|
||||
}
|
||||
}
|
||||
|
||||
_uv.tcp_bind(this, ref addr, 0);
|
||||
|
|
|
|||
|
|
@ -109,8 +109,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
[ConditionalTheory, MemberData(nameof(AddressRegistrationDataIPv6ScopeId))]
|
||||
[IPv6SupportedCondition]
|
||||
[IPv6ScopeIdPresentCondition]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Causing test failures")]
|
||||
[OSSkipCondition(OperatingSystems.Linux, SkipReason = "Causing test failures")]
|
||||
public async Task RegisterAddresses_IPv6ScopeId_Success(string addressInput, Func<IServerAddressesFeature, string[]> testUrls)
|
||||
{
|
||||
await RegisterAddresses_Success(addressInput, testUrls);
|
||||
|
|
|
|||
Loading…
Reference in New Issue