mirror of https://github.com/zlatinb/muwire
Connect to i2p router after creating the Core object, should help with plugin init issues #39
parent
853b9f67fc
commit
c7d1f0c23c
|
@ -194,7 +194,7 @@ public class Core {
|
|||
// options like tunnel length and quantity
|
||||
I2PSocketManager socketManager
|
||||
keyDat.withInputStream {
|
||||
socketManager = new I2PSocketManagerFactory().createManager(it, i2pOptions["i2cp.tcp.host"], i2pOptions["i2cp.tcp.port"].toInteger(), i2pOptions)
|
||||
socketManager = new I2PSocketManagerFactory().createDisconnectedManager(it, i2pOptions["i2cp.tcp.host"], i2pOptions["i2cp.tcp.port"].toInteger(), i2pOptions)
|
||||
}
|
||||
socketManager.getDefaultOptions().setReadTimeout(60000)
|
||||
socketManager.getDefaultOptions().setConnectTimeout(30000)
|
||||
|
@ -380,6 +380,7 @@ public class Core {
|
|||
}
|
||||
|
||||
public void startServices() {
|
||||
i2pSession.connect()
|
||||
hasherService.start()
|
||||
trustService.start()
|
||||
trustService.waitForLoad()
|
||||
|
|
|
@ -82,23 +82,23 @@ class Ready extends AbstractLifecycleHandler {
|
|||
Core core
|
||||
try {
|
||||
core = new Core(props, home, metadata["application.version"])
|
||||
Runtime.getRuntime().addShutdownHook({
|
||||
core.shutdown()
|
||||
})
|
||||
core.startServices()
|
||||
application.context.put("muwire-settings", props)
|
||||
application.context.put("core",core)
|
||||
application.getPropertyChangeListeners("core").each {
|
||||
it.propertyChange(new PropertyChangeEvent(this, "core", null, core))
|
||||
}
|
||||
|
||||
core.eventBus.publish(new UILoadedEvent())
|
||||
} catch (Exception bad) {
|
||||
log.log(Level.SEVERE,"couldn't initialize core",bad)
|
||||
JOptionPane.showMessageDialog(null, "Couldn't connect to I2P router. Make sure I2P is running and restart MuWire",
|
||||
"Can't connect to I2P router", JOptionPane.WARNING_MESSAGE)
|
||||
"Can't connect to I2P router", JOptionPane.WARNING_MESSAGE)
|
||||
System.exit(0)
|
||||
}
|
||||
Runtime.getRuntime().addShutdownHook({
|
||||
core.shutdown()
|
||||
})
|
||||
core.startServices()
|
||||
application.context.put("muwire-settings", props)
|
||||
application.context.put("core",core)
|
||||
application.getPropertyChangeListeners("core").each {
|
||||
it.propertyChange(new PropertyChangeEvent(this, "core", null, core))
|
||||
}
|
||||
|
||||
core.eventBus.publish(new UILoadedEvent())
|
||||
}
|
||||
|
||||
private String selectNickname() {
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.File;
|
|||
|
||||
import com.muwire.core.Core;
|
||||
import com.muwire.core.MuWireSettings;
|
||||
import com.muwire.core.UILoadedEvent;
|
||||
|
||||
class MWStarter extends Thread {
|
||||
private final MuWireSettings settings;
|
||||
|
@ -22,7 +23,8 @@ class MWStarter extends Thread {
|
|||
|
||||
public void run() {
|
||||
Core core = new Core(settings, home, version);
|
||||
core.startServices();
|
||||
client.setCore(core);
|
||||
core.startServices();
|
||||
core.getEventBus().publish(new UILoadedEvent());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,8 +171,6 @@ public class MuWireClient {
|
|||
servletContext.setAttribute("trustManager", trustManager);
|
||||
servletContext.setAttribute("certificateManager", certificateManager);
|
||||
servletContext.setAttribute("uploadManager", uploadManager);
|
||||
|
||||
core.getEventBus().publish(new UILoadedEvent());
|
||||
}
|
||||
|
||||
public String getHome() {
|
||||
|
|
Loading…
Reference in New Issue