stop tor in disable fn

This commit is contained in:
sneurlax 2024-06-24 12:05:23 -05:00
parent 765e2b9b2e
commit a12b6955a9

View file

@ -100,17 +100,19 @@ class TorService {
} }
} }
/// disable tor /// Disable Tor.
Future<void> disable() async { Future<void> disable() async {
if (_tor == null) { if (_tor == null) {
throw Exception("TorService.init has not been called!"); throw Exception("TorService.init has not been called!");
} }
// no need to update status and fire event if status won't change // No need to update status and fire event if status won't change.
if (_status == TorConnectionStatus.disconnected) { if (_status == TorConnectionStatus.disconnected) {
return; return;
} }
await _tor?.stop();
_updateStatusAndFireEvent( _updateStatusAndFireEvent(
status: TorConnectionStatus.disconnected, status: TorConnectionStatus.disconnected,
message: "TorService.disable call success", message: "TorService.disable call success",