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