let the socketAddress cache be global

This commit is contained in:
UbitUmarov
2024-04-27 15:47:33 +01:00
parent 16fa47e4d3
commit 8e6eeb1931
2 changed files with 18 additions and 15 deletions

View File

@@ -279,9 +279,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
IsRunningOutbound = false;
}
private static IPEndPoint dummyIP = new IPEndPoint(IPAddress.Any, 0);
private static readonly ExpiringCacheOS<SocketAddress,EndPoint> IPEndpointsCache = new(300000);
private async void AsyncBeginReceive()
{
SocketAddress workSktAddress = new(m_udpSocket.AddressFamily);
@@ -300,14 +297,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (nbytes > 0)
{
int startTick = Util.EnvironmentTickCount();
if(!IPEndpointsCache.TryGetValue(workSktAddress, 300000, out EndPoint ep))
{
ep = dummyIP.Create(workSktAddress);
IPEndpointsCache.AddOrUpdate(workSktAddress, ep, 300000);
}
buf.RemoteEndPoint = ep;
buf.RemoteEndPoint = Util.GetEndPoint(workSktAddress);;
buf.DataLength = nbytes;
UdpReceives++;