mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 15:26:03 -04:00
Extract TomP2PNode#USE_DISK_STORAGE_KEY constant
This commit is contained in:
parent
9f2e9de94f
commit
426ee28b93
@ -44,9 +44,6 @@ public abstract class MessageModule extends BitsquareModule {
|
||||
protected final void configure() {
|
||||
bind(MessageFacade.class).to(messageFacade()).asEagerSingleton();
|
||||
|
||||
// we will probably later use disk storage instead of memory storage for TomP2P
|
||||
bind(Boolean.class).annotatedWith(Names.named("useDiskStorage")).toInstance(false);
|
||||
|
||||
Node bootstrapNode = Node.at(
|
||||
properties.getProperty(BOOTSTRAP_NODE_ID_KEY, DEFAULT_BOOTSTRAP_NODE.getId()),
|
||||
properties.getProperty(BOOTSTRAP_NODE_IP_KEY, DEFAULT_BOOTSTRAP_NODE.getIp()),
|
||||
|
@ -20,6 +20,8 @@ package io.bitsquare.msg.tomp2p;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
import io.bitsquare.msg.MessageModule;
|
||||
|
||||
import com.google.inject.name.Names;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class TomP2PMessageModule extends MessageModule {
|
||||
@ -30,6 +32,9 @@ public class TomP2PMessageModule extends MessageModule {
|
||||
|
||||
@Override
|
||||
protected void doConfigure() {
|
||||
// we will probably later use disk storage instead of memory storage for TomP2P
|
||||
bind(Boolean.class).annotatedWith(Names.named(TomP2PNode.USE_DISK_STORAGE_KEY)).toInstance(false);
|
||||
|
||||
bind(TomP2PNode.class).asEagerSingleton();
|
||||
bind(BootstrappedPeerFactory.class).asEagerSingleton();
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ import static io.bitsquare.util.tomp2p.BaseFutureUtil.isSuccess;
|
||||
public class TomP2PNode {
|
||||
private static final Logger log = LoggerFactory.getLogger(TomP2PNode.class);
|
||||
|
||||
static final String USE_DISK_STORAGE_KEY = "useDiskStorage";
|
||||
|
||||
private KeyPair keyPair;
|
||||
private String appName;
|
||||
private final Boolean useDiskStorage;
|
||||
@ -96,7 +98,7 @@ public class TomP2PNode {
|
||||
@Inject
|
||||
public TomP2PNode(BootstrappedPeerFactory bootstrappedPeerFactory,
|
||||
@Named("appName") String appName,
|
||||
@Named("useDiskStorage") Boolean useDiskStorage) {
|
||||
@Named(USE_DISK_STORAGE_KEY) Boolean useDiskStorage) {
|
||||
this.bootstrappedPeerFactory = bootstrappedPeerFactory;
|
||||
this.appName = appName;
|
||||
this.useDiskStorage = useDiskStorage;
|
||||
@ -127,7 +129,7 @@ public class TomP2PNode {
|
||||
}
|
||||
|
||||
public void start(int port, BootstrapListener bootstrapListener) {
|
||||
useDiscStorage(useDiskStorage);
|
||||
useDiskStorage(useDiskStorage);
|
||||
|
||||
bootstrappedPeerFactory.setStorage(storage);
|
||||
setupTimerForIPCheck();
|
||||
@ -392,8 +394,8 @@ public class TomP2PNode {
|
||||
return putDomainProtectedData(locationKey, data);
|
||||
}
|
||||
|
||||
private void useDiscStorage(boolean useDiscStorage) {
|
||||
if (useDiscStorage) {
|
||||
private void useDiskStorage(boolean useDiskStorage) {
|
||||
if (useDiskStorage) {
|
||||
File path = new File(AppDirectory.dir(appName).toFile() + "/tomP2P");
|
||||
if (!path.exists()) {
|
||||
boolean created = path.mkdir();
|
||||
|
Loading…
x
Reference in New Issue
Block a user