mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-02-02 01:25:19 -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);
|
xmrConnectionService.setAutoSwitch(autoSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getXmrConnectionAutoSwitch() {
|
||||||
|
return xmrConnectionService.getAutoSwitch();
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Monero node
|
// Monero node
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -349,6 +349,11 @@ public final class XmrConnectionService {
|
|||||||
connectionList.setAutoSwitch(autoSwitch);
|
connectionList.setAutoSwitch(autoSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getAutoSwitch() {
|
||||||
|
accountService.checkAccountOpen();
|
||||||
|
return connectionManager.getAutoSwitch();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isConnectionLocalHost() {
|
public boolean isConnectionLocalHost() {
|
||||||
return isConnectionLocalHost(getConnection());
|
return isConnectionLocalHost(getConnection());
|
||||||
}
|
}
|
||||||
@ -596,7 +601,7 @@ public final class XmrConnectionService {
|
|||||||
} else if (!isInitialized) {
|
} else if (!isInitialized) {
|
||||||
|
|
||||||
// set connection from startup argument if given
|
// 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);
|
MoneroRpcConnection connection = new MoneroRpcConnection(config.xmrNode, config.xmrNodeUsername, config.xmrNodePassword).setPriority(1);
|
||||||
if (isProxyApplied(connection)) connection.setProxyUri(getProxyUri());
|
if (isProxyApplied(connection)) connection.setProxyUri(getProxyUri());
|
||||||
connectionManager.setConnection(connection);
|
connectionManager.setConnection(connection);
|
||||||
|
@ -55,6 +55,8 @@ import haveno.proto.grpc.RemoveConnectionReply;
|
|||||||
import haveno.proto.grpc.RemoveConnectionRequest;
|
import haveno.proto.grpc.RemoveConnectionRequest;
|
||||||
import haveno.proto.grpc.SetAutoSwitchReply;
|
import haveno.proto.grpc.SetAutoSwitchReply;
|
||||||
import haveno.proto.grpc.SetAutoSwitchRequest;
|
import haveno.proto.grpc.SetAutoSwitchRequest;
|
||||||
|
import haveno.proto.grpc.GetAutoSwitchRequest;
|
||||||
|
import haveno.proto.grpc.GetAutoSwitchReply;
|
||||||
import haveno.proto.grpc.SetConnectionReply;
|
import haveno.proto.grpc.SetConnectionReply;
|
||||||
import haveno.proto.grpc.SetConnectionRequest;
|
import haveno.proto.grpc.SetConnectionRequest;
|
||||||
import haveno.proto.grpc.StartCheckingConnectionReply;
|
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,
|
private <_Reply> void handleRequest(StreamObserver<_Reply> responseObserver,
|
||||||
RpcRequestHandler<_Reply> handler) {
|
RpcRequestHandler<_Reply> handler) {
|
||||||
try {
|
try {
|
||||||
|
@ -323,6 +323,8 @@ service XmrConnections {
|
|||||||
}
|
}
|
||||||
rpc SetAutoSwitch(SetAutoSwitchRequest) returns (SetAutoSwitchReply) {
|
rpc SetAutoSwitch(SetAutoSwitchRequest) returns (SetAutoSwitchReply) {
|
||||||
}
|
}
|
||||||
|
rpc GetAutoSwitch(GetAutoSwitchRequest) returns (GetAutoSwitchRequest) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message UrlConnection {
|
message UrlConnection {
|
||||||
@ -410,6 +412,12 @@ message SetAutoSwitchRequest {
|
|||||||
|
|
||||||
message SetAutoSwitchReply {}
|
message SetAutoSwitchReply {}
|
||||||
|
|
||||||
|
message GetAutoSwitchRequest {}
|
||||||
|
|
||||||
|
message GetAutoSwitchReply {
|
||||||
|
bool auto_switch = 1;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// XmrNode
|
// XmrNode
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user