Skip to content

Commit

Permalink
Merge pull request #96 from osociety/scan-hangs
Browse files Browse the repository at this point in the history
Fixes freeze issue in port scan for full range
  • Loading branch information
git-elliot authored Jan 28, 2024
2 parents bd46de5 + 67f5d77 commit 2620e8b
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 12 deletions.
14 changes: 12 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@
"type": "dart"
},
{
"name": "vernet (profile mode)",
"name": "Vernet (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "Vernet F-droid (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
"flutterMode": "profile",
"args": [
"--flavor",
"fdroid"
]
},
{
"name": "F-droid",
Expand Down
1 change: 1 addition & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions:
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed full port scan freeze issue.
Theme and framework update.
Minor bug fixes and improvements.
9 changes: 7 additions & 2 deletions lib/helper/app_settings.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

class AppSettings {
Expand Down Expand Up @@ -45,20 +46,24 @@ class AppSettings {
}

Future<void> load() async {
debugPrint("Fetching all app settings");
_firstSubnet =
(await SharedPreferences.getInstance()).getInt(_firstSubnetKey) ??
_firstSubnet;

debugPrint("First subnet : $_firstSubnet");
_lastSubnet =
(await SharedPreferences.getInstance()).getInt(_lastSubnetKey) ??
_lastSubnet;
debugPrint("Last subnet : $_lastSubnet");

_socketTimeout =
(await SharedPreferences.getInstance()).getInt(_socketTimeoutKey) ??
_socketTimeout;

debugPrint("Socket timeout : $_socketTimeout");
_pingCount =
(await SharedPreferences.getInstance()).getInt(_pingCountKey) ??
_pingCount;

debugPrint("Ping count : $_socketTimeout");
}
}
7 changes: 4 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import 'package:vernet/pages/home_page.dart';
import 'package:vernet/pages/location_consent_page.dart';
import 'package:vernet/pages/settings_page.dart';

late AppSettings appSettings;
AppSettings appSettings = AppSettings.instance;
Future<void> main() async {
configureDependencies(Env.prod);
WidgetsFlutterBinding.ensureInitialized();
final appDocDirectory = await getApplicationDocumentsDirectory();
await configureNetworkTools(appDocDirectory.path, enableDebugging: true);
await configureNetworkTools(appDocDirectory.path);
final bool allowed = await ConsentLoader.isConsentPageShown();

appSettings = AppSettings.instance..load();
// load app settings
await appSettings.load();
runApp(MyApp(allowed));
}

Expand Down
1 change: 1 addition & 0 deletions lib/pages/network_troubleshoot/port_scan_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class _PortScanPageState extends State<PortScanPage>
endPort: int.parse(_endPortEditingController.text),
timeout: Duration(milliseconds: appSettings.socketTimeout),
progressCallback: _handleProgress,
async: true,
).listen(_handleEvent, onDone: _handleOnDone);
}
}
Expand Down
2 changes: 1 addition & 1 deletion macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
NetworkInfoPlusPlugin.register(with: registry.registrar(forPlugin: "NetworkInfoPlusPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
Expand Down
4 changes: 2 additions & 2 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
network_info_plus: f4fbc7877ab7b3294500d9441dfa53cd54972d05
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95

PODFILE CHECKSUM: 4d1ddd58dcd1dc92dd2b397bbacb622f345603ab
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A Network Analyzer

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.1+16
version: 1.0.2+17

environment:
sdk: ">=2.17.0 <3.0.0"
Expand Down Expand Up @@ -34,7 +34,7 @@ dependencies:
# Discover network info and configure themselves accordingly
network_info_plus: ^4.0.2
# Helps you discover open ports, devices on subnet and more.
network_tools_flutter: ^1.0.4
network_tools_flutter: ^1.0.5
# Querying information about the application package, such as CFBundleVersion
package_info_plus: ^4.1.0
path_provider: ^2.1.1
Expand Down

0 comments on commit 2620e8b

Please sign in to comment.