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() public int GetRandomUnusedUdpPort()
{ {
var localEndPoint = new IPEndPoint(IPAddress.Any, 0); var localEndPoint = new IPEndPoint(IPAddress.Any, 0);
var udpClient = new UdpClient(localEndPoint); using (var udpClient = new UdpClient(localEndPoint))
using (udpClient)
{ {
var port = ((IPEndPoint)udpClient.Client.LocalEndPoint).Port; return ((IPEndPoint)udpClient.Client.LocalEndPoint).Port;
return port;
} }
} }