* Instead of creating a new IPEndPoint on every udp packet receive, reuse the existing one

* This requires copying details into a new endpoint when it needs to be stored in client/circuit code hashes
This commit is contained in:
Justin Clarke Casey
2008-10-17 17:57:18 +00:00
parent e4b8912296
commit 7891f821e2
2 changed files with 41 additions and 23 deletions

View File

@@ -58,7 +58,7 @@ namespace OpenSim.Framework
numBytes = x;
}
public static EndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes)
public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes)
{
// IPv4 Only
byte[] addr = new byte[4];
@@ -71,7 +71,7 @@ namespace OpenSim.Framework
ushort port = (ushort) (bytes[--numBytes] * 256);
port += (ushort) bytes[--numBytes];
return (EndPoint) new IPEndPoint(new IPAddress(addr), (int) port);
return new IPEndPoint(new IPAddress(addr), (int) port);
}
}
}