Update Emby.Server.Implementations/Networking/NetworkManager.cs

Co-authored-by: Cody Robibero <cody@robibe.ro>
This commit is contained in:
BaronGreenback 2020-06-01 09:57:17 +01:00 committed by GitHub
parent 3a5333228f
commit 455e464445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,11 +114,9 @@ namespace Emby.Server.Implementations.Networking
public int GetRandomUnusedUdpPort()
{
var localEndPoint = new IPEndPoint(IPAddress.Any, 0);
var udpClient = new UdpClient(localEndPoint);
using (udpClient)
using (var udpClient = new UdpClient(localEndPoint))
{
var port = ((IPEndPoint)udpClient.Client.LocalEndPoint).Port;
return port;
return ((IPEndPoint)udpClient.Client.LocalEndPoint).Port;
}
}