Initialize Reverse Proxy in constructor

This commit is contained in:
MaxXor 2018-11-26 18:48:37 +01:00
parent 871d29fe0b
commit 3741836281
1 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ public class ReverseProxyHandler : MessageProcessorBase<ReverseProxyClient[]>
/// <summary> /// <summary>
/// The reverse proxy server to accept & serve SOCKS5 connections. /// The reverse proxy server to accept & serve SOCKS5 connections.
/// </summary> /// </summary>
private ReverseProxyServer _socksServer; private readonly ReverseProxyServer _socksServer;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ReverseProxyHandler"/> class using the given clients. /// Initializes a new instance of the <see cref="ReverseProxyHandler"/> class using the given clients.
@ -25,6 +25,7 @@ public class ReverseProxyHandler : MessageProcessorBase<ReverseProxyClient[]>
/// <param name="clients">The associated clients.</param> /// <param name="clients">The associated clients.</param>
public ReverseProxyHandler(Client[] clients) : base(true) public ReverseProxyHandler(Client[] clients) : base(true)
{ {
_socksServer = new ReverseProxyServer();
_clients = clients; _clients = clients;
} }
@ -59,7 +60,6 @@ public override void Execute(ISender sender, IMessage message)
/// <param name="port">The port to listen on.</param> /// <param name="port">The port to listen on.</param>
public void StartReverseProxyServer(ushort port) public void StartReverseProxyServer(ushort port)
{ {
_socksServer = new ReverseProxyServer();
_socksServer.OnConnectionEstablished += socksServer_onConnectionEstablished; _socksServer.OnConnectionEstablished += socksServer_onConnectionEstablished;
_socksServer.OnUpdateConnection += socksServer_onUpdateConnection; _socksServer.OnUpdateConnection += socksServer_onUpdateConnection;
_socksServer.StartServer(_clients, "0.0.0.0", port); _socksServer.StartServer(_clients, "0.0.0.0", port);