Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Commit

Permalink
UTF8 logo. Support for Repeater.
Browse files Browse the repository at this point in the history
  • Loading branch information
davassi committed Dec 17, 2016
1 parent de5b312 commit 5f88959
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 33 deletions.
25 changes: 0 additions & 25 deletions logo.ans

This file was deleted.

25 changes: 25 additions & 0 deletions logo.utf8.ans
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
▄███▄
 ▀███
▄▄ ▄▀▀▀
▄██▄ ▀▀▀▀ ▀█▀ ▄▄▄▄
▀▀▀▀■  ▀███ ▄▄
▄██▄ ▄█▄ ▄▀▀▀  ███
▄██▄ ▀▀ ▀▀▀▀
▄▄ ▀▀▀▀▄▄ ▄▄▄█▄ ▄▄
 ███▄▄  ███ ▀▀▀ ■ ▀▀▀▀ ████ ▄▄
▀▀ ███ ▀▀▀▀  ███
▄▄▄ ▀▀▄██▄ ▄▄▀▀
 ▀███▄▀ ▀▀ ▀▀▀▀ ▄██▄
▄▄▄ ▀▀▀▄▄▄▄ ▀▀
█████▄▄█▄▀▀▀ ▀▀▀ ▀▀▀
▀ ▀▀▀▀ ▀▄▄▄█▄
▄█▄ ▄ ▄██▄■▄ ▀
▀ ▀▀▀ ▀▀▀▀■
▄█▄ ▄▄ ▄██▄
▀ ▀▀▀▀ ▀▀▀▀ ▄▄▄
I O T A▄██▄▄▄ ████ ▄███▄
-------------------▀▀ ███▀▀▀  ████
 Ledger of Things ▄██▄ ▀▀ ▄▄▀▀▀
▀ ▀▀ ███
▀▀

4 changes: 2 additions & 2 deletions src/main/java/com/iota/iri/IRI.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ private static void shutdownHook() {
}

private static void showIotaLogo() {
final String charset = "CP437";
final String charset = "UTF8";

try {
final Path path = Paths.get("logo.ans");
final Path path = Paths.get("logo.utf8.ans");
Files.readAllLines(path, Charset.forName(charset)).forEach(log::info);
} catch (IOException e) {
log.error("Impossible to display logo. Charset {} not supported by terminal.", charset);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/iota/iri/service/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ private void sendResponse(final HttpServerExchange exchange, final AbstractRespo
if (res instanceof ErrorResponse) {
exchange.setStatusCode(400); // bad request
} else if (res instanceof ExceptionResponse) {
exchange.setStatusCode(500); // internall error
exchange.setStatusCode(500); // internal error
}

setupResponseHeaders(exchange);
Expand Down
28 changes: 23 additions & 5 deletions src/main/java/com/iota/iri/service/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class Node {
private final DatagramPacket tipRequestingPacket = new DatagramPacket(new byte[TRANSACTION_PACKET_SIZE],
TRANSACTION_PACKET_SIZE);

private final ExecutorService executor = Executors.newFixedThreadPool(4);
private final ExecutorService executor = Executors.newFixedThreadPool(Configuration.booling(DefaultConfSettings.EXPERIMENTAL) ? 5 :3);

public void init() throws Exception {

Expand Down Expand Up @@ -90,17 +90,35 @@ public void init() throws Exception {
executor.submit(spawnTipRequesterThread());

if (Configuration.booling(DefaultConfSettings.EXPERIMENTAL)) {
executor.submit(spawnNeighborDNSResolver());
executor.submit(spawnNeighborDNSRefresherThread());
executor.submit(spawnRepeaterThread());
}
executor.shutdown();
}

private Runnable spawnRepeaterThread() {
return () -> {

log.info("Spawning Repeater Thread");

while (!shuttingDown.get()) {
log.info("Repeater in Action...");
try {
Thread.sleep(1000*50);
} catch (final Exception e) {
log.error("Repeater Thread Exception:", e);
}
}
log.info("Shutting down Neighbor DNS Resolver Thread");
};
}

private Map<String, String> neighborIpCache = new HashMap<>();

private Runnable spawnNeighborDNSResolver() {
private Runnable spawnNeighborDNSRefresherThread() {
return () -> {

log.info("Spawning Neighbor DNS Checker Thread");
log.info("Spawning Neighbor DNS Refresher Thread");

while (!shuttingDown.get()) {
log.info("Checking Neighbors' Ip...");
Expand Down Expand Up @@ -135,7 +153,7 @@ private Runnable spawnNeighborDNSResolver() {

Thread.sleep(1000*60*30);
} catch (final Exception e) {
log.error("Spawning Neighbor DNS Resolver Thread Exception:", e);
log.error("Neighbor DNS Refresher Thread Exception:", e);
}
}
log.info("Shutting down Neighbor DNS Resolver Thread");
Expand Down

0 comments on commit 5f88959

Please sign in to comment.