Update json server after restart.
This commit is contained in:
parent
ed8a2b6f5f
commit
187a6b49c3
|
@ -42,6 +42,7 @@ public class EthereumRemoteService extends EthereumService {
|
||||||
static EnumMap<EventFlag, List<String>> listenersByType = new EnumMap<EventFlag, List<String>>(EventFlag.class);
|
static EnumMap<EventFlag, List<String>> listenersByType = new EnumMap<EventFlag, List<String>>(EventFlag.class);
|
||||||
|
|
||||||
public boolean isEthereumStarted = false;
|
public boolean isEthereumStarted = false;
|
||||||
|
private String currentJsonRpcServer = null;
|
||||||
|
|
||||||
public EthereumRemoteService() {
|
public EthereumRemoteService() {
|
||||||
|
|
||||||
|
@ -227,6 +228,9 @@ public class EthereumRemoteService extends EthereumService {
|
||||||
List<String> privateKeys = data.getStringArrayList("privateKeys");
|
List<String> privateKeys = data.getStringArrayList("privateKeys");
|
||||||
ethereum.init(privateKeys);
|
ethereum.init(privateKeys);
|
||||||
startJsonRpc(null);
|
startJsonRpc(null);
|
||||||
|
if (currentJsonRpcServer != null) {
|
||||||
|
this.changeJsonRpc(null);
|
||||||
|
}
|
||||||
isEthereumStarted = true;
|
isEthereumStarted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,12 +371,20 @@ public class EthereumRemoteService extends EthereumService {
|
||||||
*/
|
*/
|
||||||
protected void changeJsonRpc(Message message) {
|
protected void changeJsonRpc(Message message) {
|
||||||
|
|
||||||
|
String server = null;
|
||||||
|
if (message == null) {
|
||||||
|
if (currentJsonRpcServer != null) {
|
||||||
|
server = currentJsonRpcServer;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Bundle data = message.getData();
|
Bundle data = message.getData();
|
||||||
String server = data.getString("rpc_server");
|
server = data.getString("rpc_server");
|
||||||
if (jsonRpcServer != null) {
|
currentJsonRpcServer = server;
|
||||||
|
}
|
||||||
|
if (jsonRpcServer != null && server != null) {
|
||||||
((org.ethereum.android.jsonrpc.light.JsonRpcServer)jsonRpcServer).addRemoteServer(server, true);
|
((org.ethereum.android.jsonrpc.light.JsonRpcServer)jsonRpcServer).addRemoteServer(server, true);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("jsonRpcServer is null on changeJsonRpc ??");
|
System.out.println("jsonRpcServer or server is null on changeJsonRpc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue