Skip to content

Commit

Permalink
quick fix for the reconnection issue (#1671)
Browse files Browse the repository at this point in the history
* Update electrum.dart

* Update electrum.dart

* Duration seconds: 5 [skip ci]
  • Loading branch information
Serhii-Borodenko authored Sep 9, 2024
1 parent f279a22 commit 125fdf8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions cw_bitcoin/lib/electrum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ class ElectrumClient {
},
onDone: () {
unterminatedString = '';
if (host == socket?.address.host) {
socket = null;
_setConnectionStatus(ConnectionStatus.disconnected);
try {
if (host == socket?.address.host) {
socket?.destroy();
_setConnectionStatus(ConnectionStatus.disconnected);
}
} catch(e) {
print(e.toString());
}
},
cancelOnError: true,
Expand Down
2 changes: 1 addition & 1 deletion cw_bitcoin/lib/electrum_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ abstract class ElectrumWalletBase

_isTryingToConnect = true;

Timer(Duration(seconds: 10), () {
Timer(Duration(seconds: 5), () {
if (this.syncStatus is NotConnectedSyncStatus || this.syncStatus is LostConnectionSyncStatus) {
this.electrumClient.connectToUri(
node!.uri,
Expand Down

0 comments on commit 125fdf8

Please sign in to comment.