mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-11-22 00:47:28 -06:00
network and ios fixes
This commit is contained in:
parent
1861650d44
commit
b993063aba
@ -1678,7 +1678,10 @@ impl RPCProcessor {
|
||||
|
||||
let send_channel = {
|
||||
let inner = self.inner.lock();
|
||||
inner.send_channel.as_ref().unwrap().clone()
|
||||
let Some(send_channel) = inner.send_channel.as_ref().cloned() else {
|
||||
bail!("send channel is closed");
|
||||
};
|
||||
send_channel
|
||||
};
|
||||
let span_id = Span::current().id();
|
||||
send_channel
|
||||
@ -1714,7 +1717,10 @@ impl RPCProcessor {
|
||||
};
|
||||
let send_channel = {
|
||||
let inner = self.inner.lock();
|
||||
inner.send_channel.as_ref().unwrap().clone()
|
||||
let Some(send_channel) = inner.send_channel.as_ref().cloned() else {
|
||||
bail!("send channel is closed");
|
||||
};
|
||||
send_channel
|
||||
};
|
||||
let span_id = Span::current().id();
|
||||
send_channel
|
||||
@ -1753,7 +1759,10 @@ impl RPCProcessor {
|
||||
|
||||
let send_channel = {
|
||||
let inner = self.inner.lock();
|
||||
inner.send_channel.as_ref().unwrap().clone()
|
||||
let Some(send_channel) = inner.send_channel.as_ref().cloned() else {
|
||||
bail!("send channel is closed");
|
||||
};
|
||||
send_channel
|
||||
};
|
||||
let span_id = Span::current().id();
|
||||
send_channel
|
||||
|
@ -357,6 +357,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
system_info_plus:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: system_info_plus
|
||||
sha256: b915c811c6605b802f3988859bc2bb79c95f735762a75b5451741f7a2b949d1b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.5"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -395,7 +403,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.1.1"
|
||||
version: "0.1.6"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1,7 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:system_info2/system_info2.dart' as sysinfo;
|
||||
import 'package:system_info_plus/system_info_plus.dart';
|
||||
import 'veilid.dart';
|
||||
|
||||
const int megaByte = 1024 * 1024;
|
||||
@ -13,10 +16,13 @@ int getLocalSubkeyCacheSize() {
|
||||
return 1024;
|
||||
}
|
||||
|
||||
int getLocalMaxSubkeyCacheMemoryMb() {
|
||||
Future<int> getLocalMaxSubkeyCacheMemoryMb() async {
|
||||
if (kIsWeb) {
|
||||
return 256;
|
||||
}
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
return (await SystemInfoPlus.physicalMemory ?? 2048) ~/ 32;
|
||||
}
|
||||
return sysinfo.SysInfo.getTotalPhysicalMemory() ~/ 32 ~/ megaByte;
|
||||
}
|
||||
|
||||
@ -34,10 +40,13 @@ int getRemoteMaxRecords() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
int getRemoteMaxSubkeyCacheMemoryMb() {
|
||||
Future<int> getRemoteMaxSubkeyCacheMemoryMb() async {
|
||||
if (kIsWeb) {
|
||||
return 256;
|
||||
}
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
return (await SystemInfoPlus.physicalMemory ?? 2048) ~/ 32;
|
||||
}
|
||||
return sysinfo.SysInfo.getTotalPhysicalMemory() ~/ 32 ~/ megaByte;
|
||||
}
|
||||
|
||||
@ -121,10 +130,10 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
minPeerRefreshTimeMs: 60000,
|
||||
validateDialInfoReceiptTimeMs: 2000,
|
||||
localSubkeyCacheSize: getLocalSubkeyCacheSize(),
|
||||
localMaxSubkeyCacheMemoryMb: getLocalMaxSubkeyCacheMemoryMb(),
|
||||
localMaxSubkeyCacheMemoryMb: await getLocalMaxSubkeyCacheMemoryMb(),
|
||||
remoteSubkeyCacheSize: getRemoteSubkeyCacheSize(),
|
||||
remoteMaxRecords: getRemoteMaxRecords(),
|
||||
remoteMaxSubkeyCacheMemoryMb: getRemoteMaxSubkeyCacheMemoryMb(),
|
||||
remoteMaxSubkeyCacheMemoryMb: await getRemoteMaxSubkeyCacheMemoryMb(),
|
||||
remoteMaxStorageSpaceMb: getRemoteMaxStorageSpaceMb()),
|
||||
upnp: true,
|
||||
detectAddressChanges: true,
|
||||
|
@ -17,6 +17,7 @@ dependencies:
|
||||
path_provider: ^2.0.9
|
||||
path: ^1.8.0
|
||||
system_info2: ^3.0.2
|
||||
system_info_plus: ^0.0.5
|
||||
charcode: ^1.3.1
|
||||
freezed_annotation: ^2.2.0
|
||||
json_annotation: ^4.8.1
|
||||
|
Loading…
Reference in New Issue
Block a user