mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 10:34:32 +00:00
listen to correct socket depending on tor preference
This commit is contained in:
parent
7646f97cc1
commit
dbaf184bb8
1 changed files with 29 additions and 6 deletions
|
@ -206,12 +206,35 @@ class SubscribableElectrumXClient {
|
||||||
|
|
||||||
_updateConnectionStatus(true);
|
_updateConnectionStatus(true);
|
||||||
|
|
||||||
_socket!.listen(
|
if (_prefs.useTor) {
|
||||||
_dataHandler,
|
if (_socksSocket == null) {
|
||||||
onError: _errorHandler,
|
final String msg = "SubscribableElectrumXClient.connect(): "
|
||||||
onDone: _doneHandler,
|
"cannot listen to $host:$port via SOCKSSocket because it is not connected.";
|
||||||
cancelOnError: true,
|
Logging.instance.log(msg, level: LogLevel.Fatal);
|
||||||
);
|
throw Exception(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
_socksSocket!.listen(
|
||||||
|
_dataHandler,
|
||||||
|
onError: _errorHandler,
|
||||||
|
onDone: _doneHandler,
|
||||||
|
cancelOnError: true,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (_socket == null) {
|
||||||
|
final String msg = "SubscribableElectrumXClient.connect(): "
|
||||||
|
"cannot listen to $host:$port via socket because it is not connected.";
|
||||||
|
Logging.instance.log(msg, level: LogLevel.Fatal);
|
||||||
|
throw Exception(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
_socket!.listen(
|
||||||
|
_dataHandler,
|
||||||
|
onError: _errorHandler,
|
||||||
|
onDone: _doneHandler,
|
||||||
|
cancelOnError: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
_aliveTimer?.cancel();
|
_aliveTimer?.cancel();
|
||||||
_aliveTimer = Timer.periodic(
|
_aliveTimer = Timer.periodic(
|
||||||
|
|
Loading…
Reference in a new issue