From 5f88959f99819441b0c441ad836d0dfb2e79aa4c Mon Sep 17 00:00:00 2001 From: davassi Date: Sat, 17 Dec 2016 09:43:40 +0100 Subject: [PATCH] UTF8 logo. Support for Repeater. --- logo.ans | 25 ----------------- logo.utf8.ans | 25 +++++++++++++++++ src/main/java/com/iota/iri/IRI.java | 4 +-- src/main/java/com/iota/iri/service/API.java | 2 +- src/main/java/com/iota/iri/service/Node.java | 28 ++++++++++++++++---- 5 files changed, 51 insertions(+), 33 deletions(-) delete mode 100644 logo.ans create mode 100644 logo.utf8.ans diff --git a/logo.ans b/logo.ans deleted file mode 100644 index 2792d0e890..0000000000 --- a/logo.ans +++ /dev/null @@ -1,25 +0,0 @@ -ÜÛÛÛÜ - ßÛÛÛ -ÜÜ Üßßß -ÜÛÛÜ ßßßß ßÛß ÜÜÜÜ -ßßßßþ  ßÛÛÛ ÜÜ -ÜÛÛÜ ÜÛÜ Üßßß  ÛÛÛ -ÜÛÛÜ ßß ßßßß -ÜÜ ßßßßÜÜ ÜÜÜÛÜ ÜÜ - ÛÛÛÜÜ  ÛÛÛ ßßß þ ßßßß ÛÛÛÛ ÜÜ -ßß ÛÛÛ ßßßß  ÛÛÛ -ÜÜÜ ßßÜÛÛÜ ÜÜßß - ßÛÛÛÜß ßß ßßßß ÜÛÛÜ -ÜÜÜ ßßßÜÜÜÜ ßß -ÛÛÛÛÛÜÜÛÜßßß ßßß ßßß -ß ßßßß ßÜÜÜÛÜ -ÜÛÜ Ü ÜÛÛÜþÜ ß -ß ßßß ßßßßþ -ÜÛÜ ÜÜ ÜÛÛÜ -ß ßßßß ßßßß ÜÜÜ - I O T AÜÛÛÜÜÜ ÛÛÛÛ ÜÛÛÛÜ - -------------------ßß ÛÛÛßßß  ÛÛÛÛ - Ledger of Things ÜÛÛÜ ßß ÜÜßßß -ß ßß ÛÛÛ -ßß - diff --git a/logo.utf8.ans b/logo.utf8.ans new file mode 100644 index 0000000000..2ea4d654c1 --- /dev/null +++ b/logo.utf8.ans @@ -0,0 +1,25 @@ +â–„███▄ + ▀██â–ˆ +â–„â–„ â–„▀▀▀ +â–„██▄ â–€▀▀â–€ â–€█▀ â–„â–„â–„â–„ +â–€▀▀▀■  ▀███ â–„â–„ +â–„██▄ â–„█▄ â–„▀▀▀  â–ˆ██ +â–„██▄ ▀▀ ▀▀▀▀ +â–„â–„ â–€▀▀▀▄▄ â–„â–„â–„█▄ â–„â–„ + ███▄▄  ███ ▀▀▀ â–  â–€▀▀â–€ ████ â–„â–„ +▀▀ â–ˆ██ ▀▀▀▀  ███ +â–„â–„â–„ ▀▀â–„â–ˆ█▄ â–„â–„▀▀ + ▀███â–„â–€ ▀▀ â–€▀▀â–€ â–„██▄ +â–„â–„â–„ ▀▀▀â–„â–„â–„â–„ ▀▀ +â–ˆ████â–„â–„█▄▀▀▀ ▀▀▀ ▀▀▀ +â–€ ▀▀▀▀ ▀▄▄▄█▄ +▄█▄ â–„ â–„██▄â– â–„ â–€ +â–€ ▀▀▀ â–€▀▀▀■ +▄█▄ â–„â–„ â–„██â–„ +â–€ â–€▀▀â–€ â–€▀▀â–€ â–„â–„â–„ + I O T Aâ–„██â–„â–„â–„ ████ â–„███â–„ + -------------------▀▀ ██â–ˆ▀▀▀  ████ + Ledger of Things â–„██â–„ ▀▀ â–„â–„▀▀▀ +â–€ ▀▀ ██â–ˆ +▀▀ + diff --git a/src/main/java/com/iota/iri/IRI.java b/src/main/java/com/iota/iri/IRI.java index 2f86d82827..9231ce4a1e 100644 --- a/src/main/java/com/iota/iri/IRI.java +++ b/src/main/java/com/iota/iri/IRI.java @@ -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); diff --git a/src/main/java/com/iota/iri/service/API.java b/src/main/java/com/iota/iri/service/API.java index 7ad3e86b9c..6e5a232be6 100644 --- a/src/main/java/com/iota/iri/service/API.java +++ b/src/main/java/com/iota/iri/service/API.java @@ -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); diff --git a/src/main/java/com/iota/iri/service/Node.java b/src/main/java/com/iota/iri/service/Node.java index 6b358542b4..8514e75f6b 100644 --- a/src/main/java/com/iota/iri/service/Node.java +++ b/src/main/java/com/iota/iri/service/Node.java @@ -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 { @@ -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 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..."); @@ -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");