mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-01-21 20:21:07 -05:00
ability to get Auto thingy in gprc
This commit is contained in:
parent
11c0f7613b
commit
931d1b7766
@ -247,6 +247,10 @@ public class CoreApi {
|
||||
xmrConnectionService.setAutoSwitch(autoSwitch);
|
||||
}
|
||||
|
||||
public boolean getXmrConnectionAutoSwitch() {
|
||||
return xmrConnectionService.getAutoSwitch();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Monero node
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -349,6 +349,11 @@ public final class XmrConnectionService {
|
||||
connectionList.setAutoSwitch(autoSwitch);
|
||||
}
|
||||
|
||||
public boolean getAutoSwitch() {
|
||||
accountService.checkAccountOpen();
|
||||
return connectionManager.getAutoSwitch();
|
||||
}
|
||||
|
||||
public boolean isConnectionLocalHost() {
|
||||
return isConnectionLocalHost(getConnection());
|
||||
}
|
||||
@ -596,7 +601,7 @@ public final class XmrConnectionService {
|
||||
} else if (!isInitialized) {
|
||||
|
||||
// set connection from startup argument if given
|
||||
connectionManager.setAutoSwitch(false);
|
||||
connectionManager.setAutoSwitch(true);
|
||||
MoneroRpcConnection connection = new MoneroRpcConnection(config.xmrNode, config.xmrNodeUsername, config.xmrNodePassword).setPriority(1);
|
||||
if (isProxyApplied(connection)) connection.setProxyUri(getProxyUri());
|
||||
connectionManager.setConnection(connection);
|
||||
|
@ -55,6 +55,8 @@ import haveno.proto.grpc.RemoveConnectionReply;
|
||||
import haveno.proto.grpc.RemoveConnectionRequest;
|
||||
import haveno.proto.grpc.SetAutoSwitchReply;
|
||||
import haveno.proto.grpc.SetAutoSwitchRequest;
|
||||
import haveno.proto.grpc.GetAutoSwitchRequest;
|
||||
import haveno.proto.grpc.GetAutoSwitchReply;
|
||||
import haveno.proto.grpc.SetConnectionReply;
|
||||
import haveno.proto.grpc.SetConnectionRequest;
|
||||
import haveno.proto.grpc.StartCheckingConnectionReply;
|
||||
@ -221,6 +223,15 @@ class GrpcXmrConnectionService extends XmrConnectionsImplBase {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAutoSwitch(GetAutoSwitchRequest request,
|
||||
StreamObserver<GetAutoSwitchReply> responseObserver) {
|
||||
handleRequest(responseObserver, () -> {
|
||||
coreApi.getXmrConnectionAutoSwitch();
|
||||
return GetAutoSwitchReply.newBuilder().build();
|
||||
});
|
||||
}
|
||||
|
||||
private <_Reply> void handleRequest(StreamObserver<_Reply> responseObserver,
|
||||
RpcRequestHandler<_Reply> handler) {
|
||||
try {
|
||||
|
@ -323,6 +323,8 @@ service XmrConnections {
|
||||
}
|
||||
rpc SetAutoSwitch(SetAutoSwitchRequest) returns (SetAutoSwitchReply) {
|
||||
}
|
||||
rpc GetAutoSwitch(GetAutoSwitchRequest) returns (GetAutoSwitchRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
message UrlConnection {
|
||||
@ -410,6 +412,12 @@ message SetAutoSwitchRequest {
|
||||
|
||||
message SetAutoSwitchReply {}
|
||||
|
||||
message GetAutoSwitchRequest {}
|
||||
|
||||
message GetAutoSwitchReply {
|
||||
bool auto_switch = 1;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// XmrNode
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user