Make _proxyEndpoints thread-safe
This commit is contained in:
parent
44b81ba59e
commit
52736269d7
1 changed files with 3 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl;
|
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
@ -8,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy
|
||||||
{
|
{
|
||||||
public static class ProxyManager
|
public static class ProxyManager
|
||||||
{
|
{
|
||||||
private static readonly Dictionary<string, EndPoint> _proxyEndpoints = new();
|
private static readonly ConcurrentDictionary<string, EndPoint> _proxyEndpoints = new();
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private static string GetKey(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
|
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)
|
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 _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue