updated a few places to use NetState.Address rather than Socket.RemoteEndPoint.Address
added Utility.Intern(IPAddress) and implemented where appropriate
This commit is contained in:
parent
442b48d406
commit
e15ed963d8
9 changed files with 29 additions and 43 deletions
|
|
@ -82,6 +82,27 @@ namespace Server
|
|||
str = Intern( str );
|
||||
}
|
||||
|
||||
private static Dictionary<IPAddress, IPAddress> _ipAddressTable;
|
||||
|
||||
public static IPAddress Intern( IPAddress ipAddress ) {
|
||||
if ( _ipAddressTable == null ) {
|
||||
_ipAddressTable = new Dictionary<IPAddress, IPAddress>();
|
||||
}
|
||||
|
||||
IPAddress interned;
|
||||
|
||||
if ( !_ipAddressTable.TryGetValue( ipAddress, out interned ) ) {
|
||||
interned = ipAddress;
|
||||
_ipAddressTable[ipAddress] = interned;
|
||||
}
|
||||
|
||||
return interned;
|
||||
}
|
||||
|
||||
public static void Intern( ref IPAddress ipAddress ) {
|
||||
ipAddress = Intern( ipAddress );
|
||||
}
|
||||
|
||||
public static bool IsValidIP( string text )
|
||||
{
|
||||
bool valid = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue