diff --git a/cyberwow/lib/controller/rpc.dart b/cyberwow/lib/controller/rpc.dart index 5d3688c..4e61723 100644 --- a/cyberwow/lib/controller/rpc.dart +++ b/cyberwow/lib/controller/rpc.dart @@ -30,9 +30,11 @@ Future rpc(String method) async { if (kReleaseMode) { url = 'http://127.0.0.1:34568/json_rpc'; } else { - url = 'http://192.168.10.100:34568/json_rpc'; + url = 'http://192.168.10.101:34568/json_rpc'; } + url = 'http://127.0.0.1:34568/json_rpc'; + final body = json.encode ( { @@ -42,10 +44,16 @@ Future rpc(String method) async { } ); - var response = await http.post - ( url, - body: body - ); + var response; + try { + response = await http.post + ( url, + body: body + ); + } + catch (e) { + print(e); + } return response; } @@ -57,6 +65,8 @@ Future syncInfo() async { Future targetHeight() async { var response = await syncInfo(); + if (response == null) return -1; + // print('Response status: ${response.statusCode}'); if (response.statusCode != 200) { return -1; @@ -69,6 +79,8 @@ Future targetHeight() async { Future height() async { var response = await syncInfo(); + if (response == null) return -1; + // print('Response status: ${response.statusCode}'); if (response.statusCode != 200) { return -1; diff --git a/cyberwow/lib/state.dart b/cyberwow/lib/state.dart index 521493c..7efe19f 100644 --- a/cyberwow/lib/state.dart +++ b/cyberwow/lib/state.dart @@ -171,7 +171,7 @@ class SyncedState extends HookedState { while (true) { final _targetHeight = await rpc.targetHeight(); - if (_targetHeight != 0) break; + if (_targetHeight > 0) break; height = await rpc.height(); await Future.delayed(const Duration(seconds: 2), () => "1");