1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-17 17:26:39 +00:00

Make _proxyEndpoints thread-safe

This commit is contained in:
TSR Berry 2024-09-24 15:50:04 +02:00
parent 44b81ba59e
commit 52736269d7
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2

View file

@ -1,4 +1,5 @@
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
@ -8,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy
{
public static class ProxyManager
{
private static readonly Dictionary<string, EndPoint> _proxyEndpoints = new();
private static readonly ConcurrentDictionary<string, EndPoint> _proxyEndpoints = new();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static string GetKey(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
@ -46,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy
public static bool Remove(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
{
return _proxyEndpoints.Remove(GetKey(addressFamily, socketType, protocolType));
return _proxyEndpoints.Remove(GetKey(addressFamily, socketType, protocolType), out _);
}
}
}