mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 19:05:51 +00:00
Remove isolate stuff
This commit is contained in:
parent
3a04fce46d
commit
9d6c04f68f
1 changed files with 0 additions and 60 deletions
|
@ -73,50 +73,6 @@ abstract class ListenerManager {
|
||||||
static Pointer<Void>? pointer;
|
static Pointer<Void>? pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// isolate
|
|
||||||
|
|
||||||
Map<ReceivePort, Isolate> isolates = {};
|
|
||||||
|
|
||||||
Future<ReceivePort> getIsolate(Map<String, dynamic> arguments,
|
|
||||||
{String name = ""}) async {
|
|
||||||
ReceivePort receivePort =
|
|
||||||
ReceivePort(); //port for isolate to receive messages.
|
|
||||||
arguments['sendPort'] = receivePort.sendPort;
|
|
||||||
Logging.instance.log("starting isolate ${arguments['function']} name: $name",
|
|
||||||
level: LogLevel.Info);
|
|
||||||
Isolate isolate = await Isolate.spawn(executeNative, arguments);
|
|
||||||
isolates[receivePort] = isolate;
|
|
||||||
return receivePort;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> executeNative(Map<String, dynamic> arguments) async {
|
|
||||||
await Logging.instance.initInIsolate();
|
|
||||||
final SendPort sendPort = arguments['sendPort'] as SendPort;
|
|
||||||
final function = arguments['function'] as String;
|
|
||||||
try {
|
|
||||||
Logging.instance.log(
|
|
||||||
"Error Arguments for $function not formatted correctly",
|
|
||||||
level: LogLevel.Fatal);
|
|
||||||
sendPort.send("Error Arguments for $function not formatted correctly");
|
|
||||||
} catch (e, s) {
|
|
||||||
Logging.instance.log(
|
|
||||||
"An error was thrown in this isolate $function: $e\n$s",
|
|
||||||
level: LogLevel.Error);
|
|
||||||
sendPort
|
|
||||||
.send("Error An error was thrown in this isolate $function: $e\n$s");
|
|
||||||
} finally {
|
|
||||||
await Logging.instance.isar?.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void stop(ReceivePort port) {
|
|
||||||
Isolate? isolate = isolates.remove(port);
|
|
||||||
if (isolate != null) {
|
|
||||||
isolate.kill(priority: Isolate.immediate);
|
|
||||||
isolate = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> deleteEpicWallet({
|
Future<String> deleteEpicWallet({
|
||||||
required String walletId,
|
required String walletId,
|
||||||
required SecureStorageInterface secureStore,
|
required SecureStorageInterface secureStore,
|
||||||
|
@ -167,13 +123,6 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
initCache(walletId, coin);
|
initCache(walletId, coin);
|
||||||
initEpicCashHive(walletId);
|
initEpicCashHive(walletId);
|
||||||
initWalletDB(mockableOverride: mockableOverride);
|
initWalletDB(mockableOverride: mockableOverride);
|
||||||
|
|
||||||
Logging.instance.log("$walletName isolate length: ${isolates.length}",
|
|
||||||
level: LogLevel.Info);
|
|
||||||
for (final isolate in isolates.values) {
|
|
||||||
isolate.kill(priority: Isolate.immediate);
|
|
||||||
}
|
|
||||||
isolates.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const integrationTestFlag =
|
static const integrationTestFlag =
|
||||||
|
@ -392,10 +341,6 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
timer?.cancel();
|
timer?.cancel();
|
||||||
timer = null;
|
timer = null;
|
||||||
stopNetworkAlivePinging();
|
stopNetworkAlivePinging();
|
||||||
for (final isolate in isolates.values) {
|
|
||||||
isolate.kill(priority: Isolate.immediate);
|
|
||||||
}
|
|
||||||
isolates.clear();
|
|
||||||
Logging.instance.log("EpicCash_wallet exit finished", level: LogLevel.Info);
|
Logging.instance.log("EpicCash_wallet exit finished", level: LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1461,11 +1406,6 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
timer = null;
|
timer = null;
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
unawaited(startSync());
|
unawaited(startSync());
|
||||||
} else {
|
|
||||||
for (final isolate in isolates.values) {
|
|
||||||
isolate.kill(priority: Isolate.immediate);
|
|
||||||
}
|
|
||||||
isolates.clear();
|
|
||||||
}
|
}
|
||||||
this.isActive = isActive;
|
this.isActive = isActive;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue