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 {
|
||||
api "net.i2p:i2p:${i2pVersion}"
|
||||
api "net.i2p:router:${i2pVersion}"
|
||||
implementation "net.i2p.client:mstreaming:${i2pVersion}"
|
||||
api "net.i2p.client:mstreaming:${i2pVersion}"
|
||||
implementation "net.i2p.client:streaming:${i2pVersion}"
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
|
||||
|
|
|
@ -114,6 +114,7 @@ public class Core {
|
|||
final MuWireSettings muOptions
|
||||
|
||||
final I2PSession i2pSession;
|
||||
private I2PSocketManager i2pSocketManager
|
||||
final TrustService trustService
|
||||
final TrustSubscriber trustSubscriber
|
||||
private final PersisterService persisterService
|
||||
|
@ -220,14 +221,13 @@ public class Core {
|
|||
|
||||
|
||||
// options like tunnel length and quantity
|
||||
I2PSocketManager socketManager
|
||||
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)
|
||||
socketManager.getDefaultOptions().setConnectTimeout(30000)
|
||||
socketManager.addDisconnectListener({eventBus.publish(new RouterDisconnectedEvent())} as DisconnectListener)
|
||||
i2pSession = socketManager.getSession()
|
||||
i2pSocketManager.getDefaultOptions().setReadTimeout(60000)
|
||||
i2pSocketManager.getDefaultOptions().setConnectTimeout(30000)
|
||||
i2pSocketManager.addDisconnectListener({eventBus.publish(new RouterDisconnectedEvent())} as DisconnectListener)
|
||||
i2pSession = i2pSocketManager.getSession()
|
||||
|
||||
def destination = new Destination()
|
||||
spk = new SigningPrivateKey(Constants.SIG_TYPE)
|
||||
|
@ -327,7 +327,7 @@ public class Core {
|
|||
log.info("running as plugin, not initializing update client")
|
||||
|
||||
log.info("initializing connector")
|
||||
I2PConnector i2pConnector = new I2PConnector(socketManager)
|
||||
I2PConnector i2pConnector = new I2PConnector(i2pSocketManager)
|
||||
|
||||
log.info("initializing certificate client")
|
||||
CertificateClient certificateClient = new CertificateClient(eventBus, i2pConnector)
|
||||
|
@ -393,7 +393,7 @@ public class Core {
|
|||
}
|
||||
|
||||
log.info("initializing acceptor")
|
||||
I2PAcceptor i2pAcceptor = new I2PAcceptor(socketManager)
|
||||
I2PAcceptor i2pAcceptor = new I2PAcceptor(i2pSocketManager)
|
||||
connectionAcceptor = new ConnectionAcceptor(eventBus, connectionManager, props,
|
||||
i2pAcceptor, hostCache, trustService, searchManager, uploadManager, fileManager, connectionEstablisher,
|
||||
certificateManager, chatServer)
|
||||
|
@ -501,8 +501,12 @@ public class Core {
|
|||
trackerResponder.stop()
|
||||
log.info("shutting down connection manager")
|
||||
connectionManager.shutdown()
|
||||
log.info("killing i2p session")
|
||||
i2pSession.destroySession()
|
||||
if (updateClient != null) {
|
||||
log.info("shutting down update client")
|
||||
updateClient.stop()
|
||||
}
|
||||
log.info("killing socket manager")
|
||||
i2pSocketManager.destroySocketManager()
|
||||
if (router != null) {
|
||||
log.info("shutting down embedded router")
|
||||
router.shutdown(0)
|
||||
|
|
|
@ -34,6 +34,8 @@ class ConnectionEstablisher {
|
|||
final ExecutorService executor, closer
|
||||
|
||||
final Set inProgress = new ConcurrentHashSet()
|
||||
|
||||
private volatile boolean shutdown
|
||||
|
||||
ConnectionEstablisher(){}
|
||||
|
||||
|
@ -60,12 +62,15 @@ class ConnectionEstablisher {
|
|||
}
|
||||
|
||||
void stop() {
|
||||
shutdown = true
|
||||
timer.cancel()
|
||||
executor.shutdownNow()
|
||||
closer.shutdownNow()
|
||||
}
|
||||
|
||||
private void connectIfNeeded() {
|
||||
if (shutdown)
|
||||
return
|
||||
if (!connectionManager.needsConnections())
|
||||
return
|
||||
if (inProgress.size() >= CONCURRENT)
|
||||
|
@ -89,6 +94,8 @@ class ConnectionEstablisher {
|
|||
}
|
||||
|
||||
private void connect(Destination toTry) {
|
||||
if (shutdown)
|
||||
return
|
||||
log.info("starting connect to ${toTry.toBase32()}")
|
||||
try {
|
||||
def endpoint = i2pConnector.connect(toTry)
|
||||
|
@ -123,6 +130,8 @@ class ConnectionEstablisher {
|
|||
}
|
||||
|
||||
private void fail(Endpoint endpoint) {
|
||||
if (shutdown)
|
||||
return
|
||||
if (!closer.isShutdown()) {
|
||||
closer.execute {
|
||||
endpoint.close()
|
||||
|
|
|
@ -105,8 +105,8 @@ class UltrapeerConnectionManager extends ConnectionManager {
|
|||
@Override
|
||||
void shutdown() {
|
||||
super.shutdown()
|
||||
peerConnections.values().stream().parallel().forEach({v -> v.close()})
|
||||
leafConnections.values().stream().parallel().forEach({v -> v.close()})
|
||||
peerConnections.values().stream().forEach({v -> v.close()})
|
||||
leafConnections.values().stream().forEach({v -> v.close()})
|
||||
peerConnections.clear()
|
||||
leafConnections.clear()
|
||||
}
|
||||
|
|
|
@ -127,7 +127,8 @@ class CacheClient {
|
|||
|
||||
@Override
|
||||
public void disconnected(I2PSession session) {
|
||||
log.severe "I2P session disconnected"
|
||||
if (!stopped.get())
|
||||
log.severe "Cache client I2P session disconnected"
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,6 +42,8 @@ class TrackerResponder {
|
|||
|
||||
private static final long UUID_LIFETIME = 10 * 60 * 1000
|
||||
|
||||
private volatile boolean shutdown
|
||||
|
||||
TrackerResponder(I2PSession i2pSession, MuWireSettings muSettings,
|
||||
FileManager fileManager, DownloadManager downloadManager,
|
||||
MeshManager meshManager, TrustService trustService,
|
||||
|
@ -61,6 +63,7 @@ class TrackerResponder {
|
|||
}
|
||||
|
||||
void stop() {
|
||||
shutdown = true
|
||||
expireTimer.cancel()
|
||||
}
|
||||
|
||||
|
@ -200,7 +203,8 @@ class TrackerResponder {
|
|||
|
||||
@Override
|
||||
public void disconnected(I2PSession session) {
|
||||
log.severe("session disconnected")
|
||||
if (!shutdown)
|
||||
log.severe("Tracker Responder session disconnected")
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,6 +49,7 @@ class UpdateClient {
|
|||
private volatile boolean updateDownloading
|
||||
|
||||
private volatile String text
|
||||
private volatile boolean shutdown
|
||||
|
||||
UpdateClient(EventBus eventBus, I2PSession session, String myVersion, MuWireSettings settings,
|
||||
FileManager fileManager, Persona me, SigningPrivateKey spk) {
|
||||
|
@ -69,6 +70,7 @@ class UpdateClient {
|
|||
}
|
||||
|
||||
void stop() {
|
||||
shutdown = true
|
||||
timer.cancel()
|
||||
}
|
||||
|
||||
|
@ -199,7 +201,8 @@ class UpdateClient {
|
|||
|
||||
@Override
|
||||
public void disconnected(I2PSession session) {
|
||||
log.severe("I2P session disconnected")
|
||||
if (!shutdown)
|
||||
log.severe("I2P session disconnected")
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,15 +40,6 @@ class Initialize extends AbstractLifecycleHandler {
|
|||
@Override
|
||||
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");
|
||||
|
||||
if (SystemTray.isSupported() && (SystemVersion.isMac() || SystemVersion.isWindows())) {
|
||||
|
|
|
@ -1,10 +1,24 @@
|
|||
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 {
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue