mirror of https://github.com/zlatinb/muwire
clean up most of noise on console when running without a log file
parent
b9c34cb944
commit
f0aaa83b7f
|
@ -7,7 +7,7 @@ plugins {
|
||||||
dependencies {
|
dependencies {
|
||||||
api "net.i2p:i2p:${i2pVersion}"
|
api "net.i2p:i2p:${i2pVersion}"
|
||||||
api "net.i2p:router:${i2pVersion}"
|
api "net.i2p:router:${i2pVersion}"
|
||||||
implementation "net.i2p.client:mstreaming:${i2pVersion}"
|
api "net.i2p.client:mstreaming:${i2pVersion}"
|
||||||
implementation "net.i2p.client:streaming:${i2pVersion}"
|
implementation "net.i2p.client:streaming:${i2pVersion}"
|
||||||
|
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
|
||||||
|
|
|
@ -114,6 +114,7 @@ public class Core {
|
||||||
final MuWireSettings muOptions
|
final MuWireSettings muOptions
|
||||||
|
|
||||||
final I2PSession i2pSession;
|
final I2PSession i2pSession;
|
||||||
|
private I2PSocketManager i2pSocketManager
|
||||||
final TrustService trustService
|
final TrustService trustService
|
||||||
final TrustSubscriber trustSubscriber
|
final TrustSubscriber trustSubscriber
|
||||||
private final PersisterService persisterService
|
private final PersisterService persisterService
|
||||||
|
@ -220,14 +221,13 @@ public class Core {
|
||||||
|
|
||||||
|
|
||||||
// options like tunnel length and quantity
|
// options like tunnel length and quantity
|
||||||
I2PSocketManager socketManager
|
|
||||||
keyDat.withInputStream {
|
keyDat.withInputStream {
|
||||||
socketManager = new I2PSocketManagerFactory().createDisconnectedManager(it, i2pOptions["i2cp.tcp.host"], i2pOptions["i2cp.tcp.port"].toInteger(), i2pOptions)
|
i2pSocketManager = new I2PSocketManagerFactory().createDisconnectedManager(it, i2pOptions["i2cp.tcp.host"], i2pOptions["i2cp.tcp.port"].toInteger(), i2pOptions)
|
||||||
}
|
}
|
||||||
socketManager.getDefaultOptions().setReadTimeout(60000)
|
i2pSocketManager.getDefaultOptions().setReadTimeout(60000)
|
||||||
socketManager.getDefaultOptions().setConnectTimeout(30000)
|
i2pSocketManager.getDefaultOptions().setConnectTimeout(30000)
|
||||||
socketManager.addDisconnectListener({eventBus.publish(new RouterDisconnectedEvent())} as DisconnectListener)
|
i2pSocketManager.addDisconnectListener({eventBus.publish(new RouterDisconnectedEvent())} as DisconnectListener)
|
||||||
i2pSession = socketManager.getSession()
|
i2pSession = i2pSocketManager.getSession()
|
||||||
|
|
||||||
def destination = new Destination()
|
def destination = new Destination()
|
||||||
spk = new SigningPrivateKey(Constants.SIG_TYPE)
|
spk = new SigningPrivateKey(Constants.SIG_TYPE)
|
||||||
|
@ -327,7 +327,7 @@ public class Core {
|
||||||
log.info("running as plugin, not initializing update client")
|
log.info("running as plugin, not initializing update client")
|
||||||
|
|
||||||
log.info("initializing connector")
|
log.info("initializing connector")
|
||||||
I2PConnector i2pConnector = new I2PConnector(socketManager)
|
I2PConnector i2pConnector = new I2PConnector(i2pSocketManager)
|
||||||
|
|
||||||
log.info("initializing certificate client")
|
log.info("initializing certificate client")
|
||||||
CertificateClient certificateClient = new CertificateClient(eventBus, i2pConnector)
|
CertificateClient certificateClient = new CertificateClient(eventBus, i2pConnector)
|
||||||
|
@ -393,7 +393,7 @@ public class Core {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("initializing acceptor")
|
log.info("initializing acceptor")
|
||||||
I2PAcceptor i2pAcceptor = new I2PAcceptor(socketManager)
|
I2PAcceptor i2pAcceptor = new I2PAcceptor(i2pSocketManager)
|
||||||
connectionAcceptor = new ConnectionAcceptor(eventBus, connectionManager, props,
|
connectionAcceptor = new ConnectionAcceptor(eventBus, connectionManager, props,
|
||||||
i2pAcceptor, hostCache, trustService, searchManager, uploadManager, fileManager, connectionEstablisher,
|
i2pAcceptor, hostCache, trustService, searchManager, uploadManager, fileManager, connectionEstablisher,
|
||||||
certificateManager, chatServer)
|
certificateManager, chatServer)
|
||||||
|
@ -501,8 +501,12 @@ public class Core {
|
||||||
trackerResponder.stop()
|
trackerResponder.stop()
|
||||||
log.info("shutting down connection manager")
|
log.info("shutting down connection manager")
|
||||||
connectionManager.shutdown()
|
connectionManager.shutdown()
|
||||||
log.info("killing i2p session")
|
if (updateClient != null) {
|
||||||
i2pSession.destroySession()
|
log.info("shutting down update client")
|
||||||
|
updateClient.stop()
|
||||||
|
}
|
||||||
|
log.info("killing socket manager")
|
||||||
|
i2pSocketManager.destroySocketManager()
|
||||||
if (router != null) {
|
if (router != null) {
|
||||||
log.info("shutting down embedded router")
|
log.info("shutting down embedded router")
|
||||||
router.shutdown(0)
|
router.shutdown(0)
|
||||||
|
|
|
@ -35,6 +35,8 @@ class ConnectionEstablisher {
|
||||||
|
|
||||||
final Set inProgress = new ConcurrentHashSet()
|
final Set inProgress = new ConcurrentHashSet()
|
||||||
|
|
||||||
|
private volatile boolean shutdown
|
||||||
|
|
||||||
ConnectionEstablisher(){}
|
ConnectionEstablisher(){}
|
||||||
|
|
||||||
ConnectionEstablisher(EventBus eventBus, I2PConnector i2pConnector, MuWireSettings settings,
|
ConnectionEstablisher(EventBus eventBus, I2PConnector i2pConnector, MuWireSettings settings,
|
||||||
|
@ -60,12 +62,15 @@ class ConnectionEstablisher {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
|
shutdown = true
|
||||||
timer.cancel()
|
timer.cancel()
|
||||||
executor.shutdownNow()
|
executor.shutdownNow()
|
||||||
closer.shutdownNow()
|
closer.shutdownNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
private void connectIfNeeded() {
|
private void connectIfNeeded() {
|
||||||
|
if (shutdown)
|
||||||
|
return
|
||||||
if (!connectionManager.needsConnections())
|
if (!connectionManager.needsConnections())
|
||||||
return
|
return
|
||||||
if (inProgress.size() >= CONCURRENT)
|
if (inProgress.size() >= CONCURRENT)
|
||||||
|
@ -89,6 +94,8 @@ class ConnectionEstablisher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void connect(Destination toTry) {
|
private void connect(Destination toTry) {
|
||||||
|
if (shutdown)
|
||||||
|
return
|
||||||
log.info("starting connect to ${toTry.toBase32()}")
|
log.info("starting connect to ${toTry.toBase32()}")
|
||||||
try {
|
try {
|
||||||
def endpoint = i2pConnector.connect(toTry)
|
def endpoint = i2pConnector.connect(toTry)
|
||||||
|
@ -123,6 +130,8 @@ class ConnectionEstablisher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fail(Endpoint endpoint) {
|
private void fail(Endpoint endpoint) {
|
||||||
|
if (shutdown)
|
||||||
|
return
|
||||||
if (!closer.isShutdown()) {
|
if (!closer.isShutdown()) {
|
||||||
closer.execute {
|
closer.execute {
|
||||||
endpoint.close()
|
endpoint.close()
|
||||||
|
|
|
@ -105,8 +105,8 @@ class UltrapeerConnectionManager extends ConnectionManager {
|
||||||
@Override
|
@Override
|
||||||
void shutdown() {
|
void shutdown() {
|
||||||
super.shutdown()
|
super.shutdown()
|
||||||
peerConnections.values().stream().parallel().forEach({v -> v.close()})
|
peerConnections.values().stream().forEach({v -> v.close()})
|
||||||
leafConnections.values().stream().parallel().forEach({v -> v.close()})
|
leafConnections.values().stream().forEach({v -> v.close()})
|
||||||
peerConnections.clear()
|
peerConnections.clear()
|
||||||
leafConnections.clear()
|
leafConnections.clear()
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,8 @@ class CacheClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected(I2PSession session) {
|
public void disconnected(I2PSession session) {
|
||||||
log.severe "I2P session disconnected"
|
if (!stopped.get())
|
||||||
|
log.severe "Cache client I2P session disconnected"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,8 @@ class TrackerResponder {
|
||||||
|
|
||||||
private static final long UUID_LIFETIME = 10 * 60 * 1000
|
private static final long UUID_LIFETIME = 10 * 60 * 1000
|
||||||
|
|
||||||
|
private volatile boolean shutdown
|
||||||
|
|
||||||
TrackerResponder(I2PSession i2pSession, MuWireSettings muSettings,
|
TrackerResponder(I2PSession i2pSession, MuWireSettings muSettings,
|
||||||
FileManager fileManager, DownloadManager downloadManager,
|
FileManager fileManager, DownloadManager downloadManager,
|
||||||
MeshManager meshManager, TrustService trustService,
|
MeshManager meshManager, TrustService trustService,
|
||||||
|
@ -61,6 +63,7 @@ class TrackerResponder {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
|
shutdown = true
|
||||||
expireTimer.cancel()
|
expireTimer.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +203,8 @@ class TrackerResponder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected(I2PSession session) {
|
public void disconnected(I2PSession session) {
|
||||||
log.severe("session disconnected")
|
if (!shutdown)
|
||||||
|
log.severe("Tracker Responder session disconnected")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -49,6 +49,7 @@ class UpdateClient {
|
||||||
private volatile boolean updateDownloading
|
private volatile boolean updateDownloading
|
||||||
|
|
||||||
private volatile String text
|
private volatile String text
|
||||||
|
private volatile boolean shutdown
|
||||||
|
|
||||||
UpdateClient(EventBus eventBus, I2PSession session, String myVersion, MuWireSettings settings,
|
UpdateClient(EventBus eventBus, I2PSession session, String myVersion, MuWireSettings settings,
|
||||||
FileManager fileManager, Persona me, SigningPrivateKey spk) {
|
FileManager fileManager, Persona me, SigningPrivateKey spk) {
|
||||||
|
@ -69,6 +70,7 @@ class UpdateClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
|
shutdown = true
|
||||||
timer.cancel()
|
timer.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +201,7 @@ class UpdateClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected(I2PSession session) {
|
public void disconnected(I2PSession session) {
|
||||||
|
if (!shutdown)
|
||||||
log.severe("I2P session disconnected")
|
log.severe("I2P session disconnected")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,15 +40,6 @@ class Initialize extends AbstractLifecycleHandler {
|
||||||
@Override
|
@Override
|
||||||
void execute() {
|
void execute() {
|
||||||
|
|
||||||
if (System.getProperty("java.util.logging.config.file") == null) {
|
|
||||||
log.info("No config file specified, so turning off most logging")
|
|
||||||
def names = LogManager.getLogManager().getLoggerNames()
|
|
||||||
while(names.hasMoreElements()) {
|
|
||||||
def name = names.nextElement()
|
|
||||||
LogManager.getLogManager().getLogger(name).setLevel(Level.SEVERE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.setProperty("apple.eawt.quitStrategy", "CLOSE_ALL_WINDOWS");
|
System.setProperty("apple.eawt.quitStrategy", "CLOSE_ALL_WINDOWS");
|
||||||
|
|
||||||
if (SystemTray.isSupported() && (SystemVersion.isMac() || SystemVersion.isWindows())) {
|
if (SystemTray.isSupported() && (SystemVersion.isMac() || SystemVersion.isWindows())) {
|
||||||
|
|
|
@ -1,10 +1,24 @@
|
||||||
package com.muwire.gui
|
package com.muwire.gui
|
||||||
|
|
||||||
import griffon.swing.SwingGriffonApplication
|
import java.util.logging.Level
|
||||||
|
import java.util.logging.LogManager
|
||||||
|
|
||||||
|
import griffon.swing.SwingGriffonApplication
|
||||||
|
import groovy.util.logging.Log
|
||||||
|
|
||||||
|
@Log
|
||||||
class Launcher {
|
class Launcher {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
if (System.getProperty("java.util.logging.config.file") == null) {
|
||||||
|
log.info("No config file specified, so turning off most logging")
|
||||||
|
def names = LogManager.getLogManager().getLoggerNames()
|
||||||
|
while(names.hasMoreElements()) {
|
||||||
|
def name = names.nextElement()
|
||||||
|
LogManager.getLogManager().getLogger(name).setLevel(Level.SEVERE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SwingGriffonApplication.main(args)
|
SwingGriffonApplication.main(args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue