From a7950af335ccb3525122a0717f2f9b854aa51321 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 4 Oct 2017 21:56:27 +0200 Subject: [PATCH] remove code related to restarting RPC server on entering background (#2008) * remove restart-rpc-server, stop-rpc-server, start-rpc-server functions and related code * clean native code --- .../status/ethereum/module/StatusModule.java | 36 ------------------- .../ios/RCTStatus/RCTStatus.m | 20 ----------- src/status_im/native_module/core.cljs | 12 ------- src/status_im/native_module/impl/module.cljs | 29 --------------- .../impl/non_status_go_module.cljs | 3 -- src/status_im/native_module/module.cljs | 3 -- src/status_im/protocol/handlers.cljs | 1 - src/status_im/ui/screens/events.cljs | 17 ++------- 8 files changed, 3 insertions(+), 118 deletions(-) diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java index 9226f72bf8..5208eab95f 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java @@ -320,42 +320,6 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL thread.start(); } - @ReactMethod - public void startNodeRPCServer() { - Log.d(TAG, "startNodeRPCServer"); - final Activity activity = getCurrentActivity(); - if (activity == null) { - return; - } - - Thread thread = new Thread() { - @Override - public void run() { - Statusgo.StartNodeRPCServer(); - } - }; - - thread.start(); - } - - @ReactMethod - public void stopNodeRPCServer() { - Log.d(TAG, "stopNodeRPCServer"); - final Activity activity = getCurrentActivity(); - if (activity == null) { - return; - } - - Thread thread = new Thread() { - @Override - public void run() { - Statusgo.StopNodeRPCServer(); - } - }; - - thread.start(); - } - @ReactMethod public void stopNode() { diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 7bbe913741..025e8c5b08 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -214,26 +214,6 @@ RCT_EXPORT_METHOD(moveToInternalStorage:(RCTResponseSenderBlock)onResultCallback onResultCallback(@[[NSNull null]]); } -//////////////////////////////////////////////////////////////////// -#pragma mark - StartNodeRPCServer method -//////////////////////////////////////////////////////////////////// createAccount -RCT_EXPORT_METHOD(startNodeRPCServer) { -#if DEBUG - NSLog(@"StartNodeRPCServer() method called"); -#endif - StartNodeRPCServer(); -} - -//////////////////////////////////////////////////////////////////// -#pragma mark - StopNodeRPCServer method -//////////////////////////////////////////////////////////////////// createAccount -RCT_EXPORT_METHOD(stopNodeRPCServer) { -#if DEBUG - NSLog(@"StopNodeRPCServer() method called"); -#endif - StopNodeRPCServer(); -} - //////////////////////////////////////////////////////////////////// #pragma mark - StopNode method //////////////////////////////////////////////////////////////////// StopNode diff --git a/src/status_im/native_module/core.cljs b/src/status_im/native_module/core.cljs index 997f4cb279..48f0891cff 100644 --- a/src/status_im/native_module/core.cljs +++ b/src/status_im/native_module/core.cljs @@ -36,18 +36,6 @@ (module-interface/-stop-node rns-module)) -(defn stop-rpc-server [] - (module-interface/-stop-rpc-server rns-module)) - - -(defn start-rpc-server [] - (module-interface/-start-rpc-server rns-module)) - - -(defn restart-rpc [] - (module-interface/-restart-rpc rns-module)) - - (defn create-account [password callback] (module-interface/-create-account rns-module password callback)) diff --git a/src/status_im/native_module/impl/module.cljs b/src/status_im/native_module/impl/module.cljs index d71b223db3..35248232ad 100644 --- a/src/status_im/native_module/impl/module.cljs +++ b/src/status_im/native_module/impl/module.cljs @@ -81,29 +81,6 @@ (when status (call-module #(.startNode status config)))) -(defn stop-rpc-server [] - (when status - (call-module #(.stopNodeRPCServer status)))) - -(defn start-rpc-server [] - (when status - (call-module #(.startNodeRPCServer status)))) - -(defonce restarting-rpc (atom false)) - -(defn restart-rpc [] - (when-not @restarting-rpc - (reset! restarting-rpc true) - (log/debug :restart-rpc-on-post-error) - - ;; todo maybe it would be better to use something like - ;; restart-rpc-server on status-go side - (stop-rpc-server) - (start-rpc-server) - - (go (