mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-16 02:49:43 -04:00
Add logs, cleanup
This commit is contained in:
parent
7bf99da595
commit
28e1ce4239
4 changed files with 17 additions and 11 deletions
|
@ -40,6 +40,7 @@ import scala.concurrent.duration.Duration;
|
||||||
import scala.concurrent.duration.FiniteDuration;
|
import scala.concurrent.duration.FiniteDuration;
|
||||||
|
|
||||||
public class BitSquare {
|
public class BitSquare {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(BitSquare.class);
|
||||||
|
|
||||||
private static String appName = "Bitsquare";
|
private static String appName = "Bitsquare";
|
||||||
|
|
||||||
|
@ -80,12 +81,13 @@ public class BitSquare {
|
||||||
try {
|
try {
|
||||||
Object m = inbox.receive(FiniteDuration.create(5L, "seconds"));
|
Object m = inbox.receive(FiniteDuration.create(5L, "seconds"));
|
||||||
if (m instanceof PeerInitialized) {
|
if (m instanceof PeerInitialized) {
|
||||||
System.out.println("Seed Peer Initialized on port " + ((PeerInitialized) m).getPort
|
log.debug("Seed Peer Initialized on port " + ((PeerInitialized) m).getPort
|
||||||
());
|
());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (!(e instanceof TimeoutException)) {
|
if (!(e instanceof TimeoutException)) {
|
||||||
quit = true;
|
quit = true;
|
||||||
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,9 +96,9 @@ public class BitSquare {
|
||||||
actorSystem.awaitTermination(Duration.create(5L, "seconds"));
|
actorSystem.awaitTermination(Duration.create(5L, "seconds"));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (ex instanceof TimeoutException)
|
if (ex instanceof TimeoutException)
|
||||||
System.out.println("ActorSystem did not shutdown properly.");
|
log.error("ActorSystem did not shutdown properly.");
|
||||||
else
|
else
|
||||||
System.out.println(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
seedNodeThread.start();
|
seedNodeThread.start();
|
||||||
|
|
|
@ -115,8 +115,16 @@ public class BootstrappedPeerFactory {
|
||||||
public ListenableFuture<PeerDHT> start() {
|
public ListenableFuture<PeerDHT> start() {
|
||||||
try {
|
try {
|
||||||
int randomPort = new Ports().tcpPort();
|
int randomPort = new Ports().tcpPort();
|
||||||
|
//randomPort = 6500;
|
||||||
|
/* ChannelServerConficuration csc = PeerBuilder.createDefaultChannelServerConfiguration();
|
||||||
|
csc.idleTCPSeconds(20).idleUDPSeconds(20).connectionTimeoutTCPMillis(20000);
|
||||||
|
Peer peer = new PeerBuilder(keyPair).ports(randomPort).channelServerConfiguration(csc).start();*/
|
||||||
Peer peer = new PeerBuilder(keyPair).ports(randomPort).start();
|
Peer peer = new PeerBuilder(keyPair).ports(randomPort).start();
|
||||||
PeerDHT peerDHT = new PeerBuilderDHT(peer).storageLayer(new StorageLayer(storage)).start();
|
/* Peer peer = new PeerBuilder(keyPair).ports(randomPort).portsExternal(randomPort)
|
||||||
|
.channelServerConfiguration(csc).start();
|
||||||
|
*/
|
||||||
|
PeerDHT peerDHT = new PeerBuilderDHT(peer).storageLayer(new StorageLayer
|
||||||
|
(storage)).start();
|
||||||
|
|
||||||
peer.peerBean().peerMap().addPeerMapChangeListener(new PeerMapChangeListener() {
|
peer.peerBean().peerMap().addPeerMapChangeListener(new PeerMapChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -55,6 +55,8 @@ public class SeedNodeAddress {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public enum StaticSeedNodeAddresses {
|
public enum StaticSeedNodeAddresses {
|
||||||
|
// Manfreds server: "188.226.179.109"
|
||||||
|
// Steves server: "128.199.251.106"
|
||||||
DIGITAL_OCEAN1("digitalocean1.bitsquare.io", "188.226.179.109", 5000),
|
DIGITAL_OCEAN1("digitalocean1.bitsquare.io", "188.226.179.109", 5000),
|
||||||
DIGITAL_OCEAN2("digitalocean2.bitsquare.io", "128.199.251.106", 5000),
|
DIGITAL_OCEAN2("digitalocean2.bitsquare.io", "128.199.251.106", 5000),
|
||||||
LOCALHOST("localhost", "127.0.0.1", 5000);
|
LOCALHOST("localhost", "127.0.0.1", 5000);
|
||||||
|
|
|
@ -17,12 +17,9 @@
|
||||||
|
|
||||||
package io.bitsquare.msg.actor;
|
package io.bitsquare.msg.actor;
|
||||||
|
|
||||||
import io.bitsquare.msg.SeedNodeAddress;
|
|
||||||
import io.bitsquare.msg.actor.command.InitializePeer;
|
import io.bitsquare.msg.actor.command.InitializePeer;
|
||||||
import io.bitsquare.msg.actor.event.PeerInitialized;
|
import io.bitsquare.msg.actor.event.PeerInitialized;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.tomp2p.dht.PeerBuilderDHT;
|
import net.tomp2p.dht.PeerBuilderDHT;
|
||||||
import net.tomp2p.dht.PeerDHT;
|
import net.tomp2p.dht.PeerDHT;
|
||||||
import net.tomp2p.nat.PeerBuilderNAT;
|
import net.tomp2p.nat.PeerBuilderNAT;
|
||||||
|
@ -63,10 +60,6 @@ public class DHTManager extends AbstractActor {
|
||||||
log.debug("Received message: {}", ip);
|
log.debug("Received message: {}", ip);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<SeedNodeAddress.StaticSeedNodeAddresses> staticSedNodeAddresses = SeedNodeAddress
|
|
||||||
.StaticSeedNodeAddresses.getAllSeedNodeAddresses();
|
|
||||||
SeedNodeAddress seedNodeAddress = new SeedNodeAddress(staticSedNodeAddresses.get(0));
|
|
||||||
|
|
||||||
peer = new PeerBuilder(ip.getPeerId()).ports(ip.getPort())
|
peer = new PeerBuilder(ip.getPeerId()).ports(ip.getPort())
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
|
@ -92,6 +85,7 @@ public class DHTManager extends AbstractActor {
|
||||||
.bootstrapTo(ip.getBootstrapPeers()).start();
|
.bootstrapTo(ip.getBootstrapPeers()).start();
|
||||||
futureBootstrap.awaitUninterruptibly(bootstrapTimeout);
|
futureBootstrap.awaitUninterruptibly(bootstrapTimeout);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
sender().tell(new PeerInitialized(peer.peerID(), ip.getPort()), self());
|
sender().tell(new PeerInitialized(peer.peerID(), ip.getPort()), self());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.info("The second instance has been started. If that happens at the first instance" +
|
log.info("The second instance has been started. If that happens at the first instance" +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue