/// <summary> /// Construct a new TorController, used to control TOR /// </summary> /// <param name="address">The address where the ControlPort is (usually localhost)</param> /// <param name="port">The port where TOR has binded the ControlPort</param> /// <param name="connect">If the controller should connect just after the initialization</param> protected BaseController(string address = "127.0.0.1", uint port = 9051, bool connect = true) { controlSocket = new ControlSocket(address, port, connect); canListen = true; asyncEventsListener = Task.Run(() => { ListenForAsyncEvents(); }); }
/// <summary> /// Construct a new TorController, used to control TOR /// </summary> /// <param name="address">The address where the ControlPort is (usually localhost)</param> /// <param name="port">The port where TOR has binded the ControlPort</param> /// <param name="connect">If the controller should connect just after the initialization</param> protected BaseController(string address = "127.0.0.1", uint port = 9051, bool connect = true) { _receiveData = false; ResponseTimeout = 1000; _controlSocket = new ControlSocket(address, port, connect); _controlSocket.OnLineReceived += ControlSocket_OnLineReceived; _replyReceivedHdl = new EventWaitHandle(false, EventResetMode.AutoReset); _replyBuffer = new Queue<Reply>(); }
public void Dispose(bool disposing) { Close(); if (disposing) { _controlSocket.Dispose(); _controlSocket = null; _replyReceivedHdl.Dispose(); _replyReceivedHdl = null; } }