quick fix for the reconnection issue (#1671)
* Update electrum.dart * Update electrum.dart * Duration seconds: 5 [skip ci]
Serhii committed
Sep 9, 2024 at 21:08 UTC
125fdf8b624ce931e39905045d69b6312558a983
2 files changed
+8
-4
cw_bitcoin/lib/electrum.dart
+7
-3
@@ -113,9 +113,13 @@ class ElectrumClient {
113
},
114
onDone: () {
115
unterminatedString = '';
116
- if (host == socket?.address.host) {
117
- socket = null;
118
- _setConnectionStatus(ConnectionStatus.disconnected);
116
+ try {
117
+ if (host == socket?.address.host) {
118
+ socket?.destroy();
119
+ _setConnectionStatus(ConnectionStatus.disconnected);
120
+ }
121
+ } catch(e) {
122
+ print(e.toString());
123
}
124
},
125
cancelOnError: true,
cw_bitcoin/lib/electrum_wallet.dart
+1
-1
@@ -2058,7 +2058,7 @@ abstract class ElectrumWalletBase
2058
2059
_isTryingToConnect = true;
2060
2061
- Timer(Duration(seconds: 10), () {
2061
+ Timer(Duration(seconds: 5), () {
2062
if (this.syncStatus is NotConnectedSyncStatus || this.syncStatus is LostConnectionSyncStatus) {
2063
this.electrumClient.connectToUri(
2064
node!.uri,