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
|
|
@ -740,7 +740,7 @@ namespace Server.Accounting
|
|||
|
||||
if( IPAddress.TryParse( Utility.GetText( ip, null ), out address ) )
|
||||
{
|
||||
list[count] = address;
|
||||
list[count] = Utility.Intern( address );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
@ -881,10 +881,7 @@ namespace Server.Accounting
|
|||
return false;
|
||||
}
|
||||
|
||||
IPAddress ipAddress;
|
||||
|
||||
try { ipAddress = ( (IPEndPoint) ns.Socket.RemoteEndPoint ).Address; }
|
||||
catch { return false; }
|
||||
IPAddress ipAddress = ns.Address;
|
||||
|
||||
bool accessAllowed = ( m_IPRestrictions.Length == 0 || IPLimiter.IsExempt( ipAddress ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ namespace Server.Misc
|
|||
|
||||
try
|
||||
{
|
||||
IPAddress ipAddress = ((IPEndPoint)ns.Socket.RemoteEndPoint).Address;
|
||||
IPAddress ipAddress = ns.Address;
|
||||
|
||||
if ( Utility.IPMatchClassC( accessList[0], ipAddress ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -956,7 +956,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
try
|
||||
{
|
||||
Firewall.Add( ((IPEndPoint)state.Socket.RemoteEndPoint).Address );
|
||||
Firewall.Add( state.Address );
|
||||
AddResponse( "They have been firewalled." );
|
||||
}
|
||||
catch ( Exception ex )
|
||||
|
|
|
|||
|
|
@ -993,36 +993,6 @@ namespace Server.Commands
|
|||
e.Mobile.Target = new PickMoveTarget();
|
||||
}
|
||||
|
||||
private class FirewallTarget : Target
|
||||
{
|
||||
public FirewallTarget() : base( -1, false, TargetFlags.None )
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Mobile )
|
||||
{
|
||||
Mobile targ = (Mobile)targeted;
|
||||
|
||||
NetState state = targ.NetState;
|
||||
|
||||
if ( state != null )
|
||||
{
|
||||
CommandLogging.WriteLine( from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( targeted ) );
|
||||
|
||||
try
|
||||
{
|
||||
Firewall.Add( ((IPEndPoint)state.Socket.RemoteEndPoint).Address );
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Usage( "Save" )]
|
||||
[Description( "Saves the world." )]
|
||||
private static void Save_OnCommand( CommandEventArgs e )
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ namespace Server.Factions
|
|||
case 0:
|
||||
{
|
||||
m_From = reader.ReadMobile();
|
||||
m_Address = reader.ReadIPAddress();
|
||||
m_Address = Utility.Intern( reader.ReadIPAddress() );
|
||||
m_Time = reader.ReadDateTime();
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -74,9 +74,7 @@ namespace Server.Misc
|
|||
|
||||
private static bool IsLocalMachine( NetState state )
|
||||
{
|
||||
Socket sock = state.Socket;
|
||||
|
||||
IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address;
|
||||
IPAddress theirAddress = state.Address;
|
||||
|
||||
if ( IPAddress.IsLoopback( theirAddress ) )
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ namespace Server.Misc
|
|||
m_Voters = new IPAddress[reader.ReadInt()];
|
||||
|
||||
for ( int i = 0; i < m_Voters.Length; ++i )
|
||||
m_Voters[i] = reader.ReadIPAddress();
|
||||
m_Voters[i] = Utility.Intern( reader.ReadIPAddress() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue