do not initialize the update client if running as a plugin

pull/34/head
Zlatin Balevsky 2019-12-19 18:30:07 +00:00
parent c0575facec
commit 6ea1a15641
3 changed files with 10 additions and 3 deletions

View File

@ -279,10 +279,13 @@ public class Core {
log.info("initializing cache client") log.info("initializing cache client")
cacheClient = new CacheClient(eventBus,hostCache, connectionManager, i2pSession, props, 10000) cacheClient = new CacheClient(eventBus,hostCache, connectionManager, i2pSession, props, 10000)
if (!props.plugin) {
log.info("initializing update client") log.info("initializing update client")
updateClient = new UpdateClient(eventBus, i2pSession, myVersion, props, fileManager, me, spk) updateClient = new UpdateClient(eventBus, i2pSession, myVersion, props, fileManager, me, spk)
eventBus.register(FileDownloadedEvent.class, updateClient) eventBus.register(FileDownloadedEvent.class, updateClient)
eventBus.register(UIResultBatchEvent.class, updateClient) eventBus.register(UIResultBatchEvent.class, updateClient)
} else
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(socketManager)

View File

@ -41,6 +41,7 @@ class MuWireSettings {
int meshExpiration int meshExpiration
int speedSmoothSeconds int speedSmoothSeconds
boolean embeddedRouter boolean embeddedRouter
boolean plugin
int inBw, outBw int inBw, outBw
Set<String> watchedKeywords Set<String> watchedKeywords
Set<String> watchedRegexes Set<String> watchedRegexes
@ -76,6 +77,7 @@ class MuWireSettings {
hostRejectInterval = Integer.valueOf(props.getProperty("hostRejectInterval", "1")) hostRejectInterval = Integer.valueOf(props.getProperty("hostRejectInterval", "1"))
meshExpiration = Integer.valueOf(props.getProperty("meshExpiration","60")) meshExpiration = Integer.valueOf(props.getProperty("meshExpiration","60"))
embeddedRouter = Boolean.valueOf(props.getProperty("embeddedRouter","false")) embeddedRouter = Boolean.valueOf(props.getProperty("embeddedRouter","false"))
plugin = Boolean.valueOf(props.getProperty("plugin","false"))
inBw = Integer.valueOf(props.getProperty("inBw","256")) inBw = Integer.valueOf(props.getProperty("inBw","256"))
outBw = Integer.valueOf(props.getProperty("outBw","128")) outBw = Integer.valueOf(props.getProperty("outBw","128"))
searchComments = Boolean.valueOf(props.getProperty("searchComments","true")) searchComments = Boolean.valueOf(props.getProperty("searchComments","true"))
@ -130,6 +132,7 @@ class MuWireSettings {
props.setProperty("hostRejectInterval", String.valueOf(hostRejectInterval)) props.setProperty("hostRejectInterval", String.valueOf(hostRejectInterval))
props.setProperty("meshExpiration", String.valueOf(meshExpiration)) props.setProperty("meshExpiration", String.valueOf(meshExpiration))
props.setProperty("embeddedRouter", String.valueOf(embeddedRouter)) props.setProperty("embeddedRouter", String.valueOf(embeddedRouter))
props.setProperty("plugin", String.valueOf(plugin))
props.setProperty("inBw", String.valueOf(inBw)) props.setProperty("inBw", String.valueOf(inBw))
props.setProperty("outBw", String.valueOf(outBw)) props.setProperty("outBw", String.valueOf(outBw))
props.setProperty("searchComments", String.valueOf(searchComments)) props.setProperty("searchComments", String.valueOf(searchComments))

View File

@ -110,6 +110,7 @@ public class MuWireClient {
settings.setNickname(nickname); settings.setNickname(nickname);
settings.setDownloadLocation(downloadLocation); settings.setDownloadLocation(downloadLocation);
settings.setIncompleteLocation(incompleteLocation); settings.setIncompleteLocation(incompleteLocation);
settings.setPlugin(true);
PrintWriter pw = new PrintWriter(mwProps, "UTF-8"); PrintWriter pw = new PrintWriter(mwProps, "UTF-8");
settings.write(pw); settings.write(pw);