Skip to content

Commit

Permalink
fix endless loop in GetActiveUdpListeners (#35078)
Browse files Browse the repository at this point in the history
  • Loading branch information
wfurt authored Apr 17, 2020
1 parent abd77c5 commit c9f1625
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public override IPEndPoint[] GetActiveUdpListeners()
while (result == Interop.IpHlpApi.ERROR_INSUFFICIENT_BUFFER)
{
// Allocate the buffer and get the UDP table.
IntPtr buffer = IntPtr.Zero;
IntPtr buffer = Marshal.AllocHGlobal((int)size);

try
{
result = Interop.IpHlpApi.GetUdpTable(buffer, ref size, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public IPGlobalPropertiesTest(ITestOutputHelper output)
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public void IPGlobalProperties_AccessAllMethods_NoErrors()
{
IPGlobalProperties gp = IPGlobalProperties.GetIPGlobalProperties();
Expand All @@ -54,7 +53,6 @@ public void IPGlobalProperties_AccessAllMethods_NoErrors()

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
[MemberData(nameof(Loopbacks))]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public void IPGlobalProperties_TcpListeners_Succeed(IPAddress address)
{
using (var server = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
Expand All @@ -80,7 +78,6 @@ public void IPGlobalProperties_TcpListeners_Succeed(IPAddress address)

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
[MemberData(nameof(Loopbacks))]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public async Task IPGlobalProperties_TcpActiveConnections_Succeed(IPAddress address)
{
using (var server = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
Expand Down Expand Up @@ -110,7 +107,6 @@ public async Task IPGlobalProperties_TcpActiveConnections_Succeed(IPAddress addr
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public void IPGlobalProperties_TcpActiveConnections_NotListening()
{
TcpConnectionInformation[] tcpCconnections = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections();
Expand Down

0 comments on commit c9f1625

Please sign in to comment.