Changed property

This commit is contained in:
MaxXor 2015-07-12 23:47:54 +02:00
parent 887f3ab34a
commit bc3c6caac4
1 changed files with 11 additions and 11 deletions

View File

@ -9,7 +9,7 @@ public class ConnectionHandler
/// <summary> /// <summary>
/// The Server which this class is handling. /// The Server which this class is handling.
/// </summary> /// </summary>
private Server ListenServer { get; set; } private readonly Server _server;
/// <summary> /// <summary>
/// A hashset containing all unique client IDs that have ever connected to the server. /// A hashset containing all unique client IDs that have ever connected to the server.
@ -29,17 +29,17 @@ public class ConnectionHandler
/// <summary> /// <summary>
/// The listening state of the server. True if listening, else False. /// The listening state of the server. True if listening, else False.
/// </summary> /// </summary>
public bool Listening { get { return ListenServer.Listening; } } public bool Listening { get { return _server.Listening; } }
/// <summary> /// <summary>
/// The total amount of received bytes. /// The total amount of received bytes.
/// </summary> /// </summary>
public long BytesReceived { get { return ListenServer.BytesReceived; } } public long BytesReceived { get { return _server.BytesReceived; } }
/// <summary> /// <summary>
/// The total amount of sent bytes. /// The total amount of sent bytes.
/// </summary> /// </summary>
public long BytesSent { get { return ListenServer.BytesSent; } } public long BytesSent { get { return _server.BytesSent; } }
/// <summary> /// <summary>
/// Occurs when the state of the server changes. /// Occurs when the state of the server changes.
@ -118,9 +118,9 @@ public ConnectionHandler()
{ {
AllTimeConnectedClients = new HashSet<string>(); AllTimeConnectedClients = new HashSet<string>();
ListenServer = new Server(); _server = new Server();
ListenServer.AddTypesToSerializer(typeof(IPacket), new Type[] _server.AddTypesToSerializer(typeof(IPacket), new Type[]
{ {
typeof (Packets.ServerPackets.InitializeCommand), typeof (Packets.ServerPackets.InitializeCommand),
typeof (Packets.ServerPackets.Disconnect), typeof (Packets.ServerPackets.Disconnect),
@ -169,9 +169,9 @@ public ConnectionHandler()
typeof (ReverseProxy.Packets.ReverseProxyDisconnect) typeof (ReverseProxy.Packets.ReverseProxyDisconnect)
}); });
ListenServer.ServerState += OnServerState; _server.ServerState += OnServerState;
ListenServer.ClientState += ClientState; _server.ClientState += ClientState;
ListenServer.ClientRead += ClientRead; _server.ClientRead += ClientRead;
} }
/// <summary> /// <summary>
@ -192,7 +192,7 @@ public void CountAllTimeConnectedClientById(string id)
/// <param name="port">Port to listen for clients on.</param> /// <param name="port">Port to listen for clients on.</param>
public void Listen(ushort port) public void Listen(ushort port)
{ {
if (!ListenServer.Listening) ListenServer.Listen(port); if (!_server.Listening) _server.Listen(port);
} }
/// <summary> /// <summary>
@ -201,7 +201,7 @@ public void Listen(ushort port)
/// </summary> /// </summary>
public void Disconnect() public void Disconnect()
{ {
if (ListenServer.Listening) ListenServer.Disconnect(); if (_server.Listening) _server.Disconnect();
} }
/// <summary> /// <summary>