mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
reuse an existing _socksSocket
This commit is contained in:
parent
6a8bf395a6
commit
658b5269d9
1 changed files with 16 additions and 6 deletions
|
@ -211,16 +211,26 @@ class JsonRPC {
|
|||
final sock = await RawSocket.connect(
|
||||
InternetAddress.loopbackIPv4, proxyInfo!.port);
|
||||
|
||||
_socksSocket = SOCKSSocket(sock);
|
||||
if (_socksSocket == null) {
|
||||
Logging.instance.log(
|
||||
"JsonRPC.connect(): failed to create SOCKS socket at $proxyInfo",
|
||||
level: LogLevel.Error);
|
||||
throw Exception(
|
||||
"JsonRPC.connect(): failed to create SOCKS socket at $proxyInfo");
|
||||
"JsonRPC.connect(): creating SOCKS socket at $proxyInfo",
|
||||
level: LogLevel.Info);
|
||||
_socksSocket = SOCKSSocket(sock);
|
||||
if (_socksSocket == null) {
|
||||
Logging.instance.log(
|
||||
"JsonRPC.connect(): failed to create SOCKS socket at $proxyInfo",
|
||||
level: LogLevel.Error);
|
||||
throw Exception(
|
||||
"JsonRPC.connect(): failed to create SOCKS socket at $proxyInfo");
|
||||
} else {
|
||||
Logging.instance.log(
|
||||
"JsonRPC.connect(): created SOCKS socket at $proxyInfo",
|
||||
level: LogLevel.Info);
|
||||
}
|
||||
} else {
|
||||
// TODO also check if sock == previous sock, eg. if RawSocket is different
|
||||
Logging.instance.log(
|
||||
"JsonRPC.connect(): created SOCKS socket at $proxyInfo",
|
||||
"JsonRPC.connect(): using pre-existing SOCKS socket at $proxyInfo",
|
||||
level: LogLevel.Info);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue