Added I2PControl method for getting I2PControl info.
This commit is contained in:
@ -96,8 +96,8 @@ public class Main {
|
|||||||
WindowHandler.toggleFrames();
|
WindowHandler.toggleFrames();
|
||||||
|
|
||||||
|
|
||||||
reseedMonitor = new Timer();
|
|
||||||
// Start running periodic task after 2 minutes, run periodically every 10th minute.
|
// Start running periodic task after 2 minutes, run periodically every 10th minute.
|
||||||
|
reseedMonitor = new Timer();
|
||||||
reseedMonitor.scheduleAtFixedRate(new ReseedMonitor(), 2*60*1000, 10*60*1000);
|
reseedMonitor.scheduleAtFixedRate(new ReseedMonitor(), 2*60*1000, 10*60*1000);
|
||||||
|
|
||||||
//testStuff(); // Delete Me
|
//testStuff(); // Delete Me
|
||||||
|
@ -16,6 +16,7 @@ import java.net.InetAddress;
|
|||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
@ -43,7 +44,6 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
|
||||||
public class SettingsFrame extends RegisteredFrame{
|
public class SettingsFrame extends RegisteredFrame{
|
||||||
private static final Log _log = LogFactory.getLog(SettingsFrame.class);
|
|
||||||
|
|
||||||
private enum LOCAL_SAVE_STATUS {
|
private enum LOCAL_SAVE_STATUS {
|
||||||
SAVE_OK,
|
SAVE_OK,
|
||||||
@ -59,19 +59,45 @@ public class SettingsFrame extends RegisteredFrame{
|
|||||||
NO_CHANGES { public String toString(){return Transl._("No changes found, settings not saved.");} }
|
NO_CHANGES { public String toString(){return Transl._("No changes found, settings not saved.");} }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private interface Address { public String getAddress();}
|
||||||
|
private enum ADDRESSES implements Address {
|
||||||
|
LOCAL { public String getAddress(){ return "127.0.0.1";}
|
||||||
|
public String toString(){ return Transl._("local host (127.0.0.1)"); }},
|
||||||
|
|
||||||
|
LAN_192_168 { public String getAddress(){ return "192.168.0.0";}
|
||||||
|
public String toString(){ return Transl._("lan host (192.168.*.*)"); }},
|
||||||
|
|
||||||
|
LAN_10 { public String getAddress(){ return "10.0.0.0";}
|
||||||
|
public String toString(){ return Transl._("lan host (10.*.*.*)"); }},
|
||||||
|
|
||||||
|
ANY { public String getAddress(){ return "0.0.0.0";}
|
||||||
|
public String toString(){ return Transl._("any host (*.*.*.*)"); }}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private static final Log _log = LogFactory.getLog(SettingsFrame.class);
|
||||||
|
private static final HashMap<String, ADDRESSES> reverseAddressMap;
|
||||||
private static Boolean instanceShown = false;
|
private static Boolean instanceShown = false;
|
||||||
|
|
||||||
// NetworkPanel
|
// ConnectPanel
|
||||||
private JTextField txtRouterIP;
|
private JTextField txtRouterIP;
|
||||||
private JTextField txtRouterPort;
|
private JTextField txtRouterPort;
|
||||||
private JPasswordField passwordField;
|
private JPasswordField passwordField;
|
||||||
// PasswordPanel
|
// ChangePanel
|
||||||
|
private JComboBox comboAddress;
|
||||||
|
private int currentComboAddressOption = 0;
|
||||||
|
private JTextField txtNewPort;
|
||||||
private JPasswordField txtNewPassword;
|
private JPasswordField txtNewPassword;
|
||||||
private JPasswordField txtRetypeNewPassword;
|
private JPasswordField txtRetypeNewPassword;
|
||||||
// PortPanel
|
|
||||||
private JTextField txtNewPort;
|
|
||||||
|
|
||||||
private ConfigurationManager _conf;
|
private ConfigurationManager _conf;
|
||||||
|
|
||||||
|
static {
|
||||||
|
reverseAddressMap = new HashMap<String,ADDRESSES>();
|
||||||
|
for (ADDRESSES n : ADDRESSES.values()){
|
||||||
|
reverseAddressMap.put(n.toString(), n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the application.
|
* Launch the application.
|
||||||
@ -94,6 +120,7 @@ public class SettingsFrame extends RegisteredFrame{
|
|||||||
*/
|
*/
|
||||||
private SettingsFrame() {
|
private SettingsFrame() {
|
||||||
_conf = ConfigurationManager.getInstance();
|
_conf = ConfigurationManager.getInstance();
|
||||||
|
GUIHelper.setDefaultStyle();
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,43 +148,33 @@ public class SettingsFrame extends RegisteredFrame{
|
|||||||
GUIHelper.setDefaultStyle();
|
GUIHelper.setDefaultStyle();
|
||||||
|
|
||||||
setTitle("itoopie Settings");
|
setTitle("itoopie Settings");
|
||||||
setBounds(0, 0, 450, 260);
|
setBounds(0, 0, 450, 310);
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
getContentPane().setLayout(null);
|
getContentPane().setLayout(null);
|
||||||
|
|
||||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
JPanel networkPanel = new JPanel();
|
JPanel connectPanel = new JPanel();
|
||||||
networkPanel.setLayout(null);
|
connectPanel.setLayout(null);
|
||||||
networkPanel.setBounds(0, 0, 426, 89);
|
connectPanel.setBounds(0, 0, 426, 99);
|
||||||
getContentPane().add(networkPanel);
|
getContentPane().add(connectPanel);
|
||||||
setupNetworkPanel(networkPanel);
|
setupConnectPanel(connectPanel);
|
||||||
|
|
||||||
|
|
||||||
JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);
|
JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);
|
||||||
separator.setBounds((96)/2, 90, (getWidth()-96), 1);
|
separator.setBounds((96)/2, 108, (getWidth()-96), 2);
|
||||||
getContentPane().add(separator);
|
getContentPane().add(separator);
|
||||||
|
|
||||||
JPanel newPasswordPanel = new JPanel();
|
JPanel newChangePanel = new JPanel();
|
||||||
newPasswordPanel.setLayout(null);
|
newChangePanel.setLayout(null);
|
||||||
newPasswordPanel.setBounds(0, 90, 426, 64);
|
newChangePanel.setBounds(0, 110, 426, 135);
|
||||||
getContentPane().add(newPasswordPanel);
|
getContentPane().add(newChangePanel);
|
||||||
setupNewPasswordPanel(newPasswordPanel);
|
setupChangePanel(newChangePanel);
|
||||||
|
|
||||||
|
|
||||||
separator = new JSeparator(SwingConstants.HORIZONTAL);
|
|
||||||
separator.setBounds((96)/2, 155, (getWidth()-96), 1);
|
|
||||||
getContentPane().add(separator);
|
|
||||||
|
|
||||||
|
|
||||||
JPanel newPortPanel = new JPanel();
|
|
||||||
newPortPanel.setLayout(null);
|
|
||||||
newPortPanel.setBounds(0, 155, 426, 35);
|
|
||||||
getContentPane().add(newPortPanel);
|
|
||||||
setupNewPortPanel(newPortPanel);
|
|
||||||
|
|
||||||
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||||
buttonPanel.setBounds(0, 200, getWidth()-10, 35);
|
buttonPanel.setBounds(0, getHeight()-60, getWidth()-10, 35);
|
||||||
getContentPane().add(buttonPanel);
|
getContentPane().add(buttonPanel);
|
||||||
|
|
||||||
|
|
||||||
@ -228,93 +245,106 @@ public class SettingsFrame extends RegisteredFrame{
|
|||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupNetworkPanel(JPanel networkPanel){
|
private void setupConnectPanel(JPanel networkPanel){
|
||||||
JLabel lblI2PControl = new JLabel(Transl._("Network:"));
|
JLabel lblI2PControl = new JLabel(Transl._("Connect to I2PControl"));
|
||||||
lblI2PControl.setBounds(10, 10, 120, 15);
|
lblI2PControl.setBounds(10, 10, 228, 15);
|
||||||
networkPanel.add(lblI2PControl);
|
networkPanel.add(lblI2PControl);
|
||||||
lblI2PControl.setHorizontalAlignment(SwingConstants.RIGHT);
|
lblI2PControl.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
|
|
||||||
JLabel lblRouterIP = new JLabel(Transl._("IP address:"));
|
JLabel lblRouterIP = new JLabel(Transl._("IP address:"));
|
||||||
lblRouterIP.setBounds(138, 10, 100, 15);
|
lblRouterIP.setBounds(138, 30, 100, 15);
|
||||||
networkPanel.add(lblRouterIP);
|
networkPanel.add(lblRouterIP);
|
||||||
lblRouterIP.setHorizontalAlignment(SwingConstants.LEFT);
|
lblRouterIP.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
txtRouterIP = new JTextField();
|
txtRouterIP = new JTextField();
|
||||||
txtRouterIP.setBounds(240, 10, 90, 19);
|
txtRouterIP.setBounds(240, 30, 90, 19);
|
||||||
networkPanel.add(txtRouterIP);
|
networkPanel.add(txtRouterIP);
|
||||||
|
|
||||||
|
|
||||||
JLabel lblRouterPort = new JLabel(Transl._("Port:"));
|
JLabel lblRouterPort = new JLabel(Transl._("Port:"));
|
||||||
lblRouterPort.setBounds(138, 35, 100, 15);
|
lblRouterPort.setBounds(10, 55, 228, 15);
|
||||||
networkPanel.add(lblRouterPort);
|
networkPanel.add(lblRouterPort);
|
||||||
lblRouterPort.setHorizontalAlignment(SwingConstants.LEFT);
|
lblRouterPort.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
txtRouterPort = new JTextField();
|
txtRouterPort = new JTextField();
|
||||||
txtRouterPort.setBounds(240, 35, 45, 19);
|
txtRouterPort.setBounds(240, 55, 45, 19);
|
||||||
networkPanel.add(txtRouterPort);
|
networkPanel.add(txtRouterPort);
|
||||||
|
|
||||||
|
|
||||||
JLabel lblRouterPassword = new JLabel(Transl._("Password:"));
|
JLabel lblRouterPassword = new JLabel(Transl._("Password:"));
|
||||||
lblRouterPassword.setBounds(138, 60, 100, 15);
|
lblRouterPassword.setBounds(10, 80, 228, 15);
|
||||||
networkPanel.add(lblRouterPassword);
|
networkPanel.add(lblRouterPassword);
|
||||||
lblRouterPassword.setHorizontalAlignment(SwingConstants.LEFT);
|
lblRouterPassword.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
passwordField = new JPasswordField();
|
passwordField = new JPasswordField();
|
||||||
passwordField.setBounds(240, 60, 90, 19);
|
passwordField.setBounds(240, 80, 90, 19);
|
||||||
networkPanel.add(passwordField);
|
networkPanel.add(passwordField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setupNewPasswordPanel(JPanel pwdPanel){
|
private void setupChangePanel(JPanel changePanel){
|
||||||
JLabel lblNewPassword = new JLabel(Transl._("New password:"));
|
JLabel lblChange = new JLabel(Transl._("Change I2PControl"));
|
||||||
lblNewPassword.setBounds(10, 10, 120, 15);
|
lblChange.setBounds(10, 10, 228, 15);
|
||||||
pwdPanel.add(lblNewPassword);
|
changePanel.add(lblChange);
|
||||||
lblNewPassword.setHorizontalAlignment(SwingConstants.RIGHT);
|
lblChange.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
|
|
||||||
JLabel lblNewPassword2 = new JLabel(Transl._("Password:"));
|
JLabel lblAddress = new JLabel(Transl._("Change address:"));
|
||||||
lblNewPassword2.setBounds(138, 10, 100, 15);
|
lblAddress.setBounds(10, 30, 228, 15);
|
||||||
pwdPanel.add(lblNewPassword2);
|
changePanel.add(lblAddress);
|
||||||
lblNewPassword2.setHorizontalAlignment(SwingConstants.LEFT);
|
lblAddress.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
txtNewPassword = new JPasswordField();
|
comboAddress = new JComboBox();
|
||||||
txtNewPassword.setBounds(240, 10, 90, 19);
|
setupAddressComboBox(comboAddress);
|
||||||
pwdPanel.add(txtNewPassword);
|
comboAddress.setBounds(240, 30, 170, 19);
|
||||||
|
changePanel.add(comboAddress);
|
||||||
|
|
||||||
|
JLabel lblPort = new JLabel(Transl._("Change port:"));
|
||||||
JLabel lblRetypeNewPassword = new JLabel(Transl._("Repeat:"));
|
lblPort.setBounds(10, 60, 228, 15);
|
||||||
lblRetypeNewPassword.setBounds(138, 35, 100, 15);
|
changePanel.add(lblPort);
|
||||||
pwdPanel.add(lblRetypeNewPassword);
|
|
||||||
lblRetypeNewPassword.setHorizontalAlignment(SwingConstants.LEFT);
|
|
||||||
|
|
||||||
txtRetypeNewPassword = new JPasswordField();
|
|
||||||
txtRetypeNewPassword.setBounds(240, 35, 90, 19);
|
|
||||||
pwdPanel.add(txtRetypeNewPassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupNewPortPanel(JPanel portPanel){
|
|
||||||
JLabel lblPort = new JLabel(Transl._("New port:"));
|
|
||||||
lblPort.setBounds(10, 10, 120, 15);
|
|
||||||
portPanel.add(lblPort);
|
|
||||||
lblPort.setHorizontalAlignment(SwingConstants.RIGHT);
|
lblPort.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
|
|
||||||
JLabel lblPort2 = new JLabel(Transl._("Port:"));
|
|
||||||
lblPort2.setBounds(138, 10, 100, 15);
|
|
||||||
portPanel.add(lblPort2);
|
|
||||||
lblPort2.setHorizontalAlignment(SwingConstants.LEFT);
|
|
||||||
|
|
||||||
txtNewPort = new JTextField();
|
txtNewPort = new JTextField();
|
||||||
txtNewPort.setBounds(240, 10, 45, 19);
|
txtNewPort.setBounds(240, 60, 45, 19);
|
||||||
portPanel.add(txtNewPort);
|
changePanel.add(txtNewPort);
|
||||||
|
|
||||||
|
|
||||||
|
JLabel lblNewPassword = new JLabel(Transl._("New password:"));
|
||||||
|
lblNewPassword.setBounds(10, 90, 228, 15);
|
||||||
|
changePanel.add(lblNewPassword);
|
||||||
|
lblNewPassword.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
|
|
||||||
|
txtNewPassword = new JPasswordField();
|
||||||
|
txtNewPassword.setBounds(240, 90, 90, 19);
|
||||||
|
changePanel.add(txtNewPassword);
|
||||||
|
|
||||||
|
|
||||||
|
JLabel lblRetypeNewPassword = new JLabel(Transl._("Repeat password:"));
|
||||||
|
lblRetypeNewPassword.setBounds(10, 115, 228, 15);
|
||||||
|
changePanel.add(lblRetypeNewPassword);
|
||||||
|
lblRetypeNewPassword.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
|
||||||
|
txtRetypeNewPassword = new JPasswordField();
|
||||||
|
txtRetypeNewPassword.setBounds(240, 115, 90, 19);
|
||||||
|
changePanel.add(txtRetypeNewPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setupAddressComboBox(JComboBox comboBox) {
|
||||||
|
for (ADDRESSES addr : ADDRESSES.values()){
|
||||||
|
comboBox.addItem(addr.toString());
|
||||||
|
}
|
||||||
|
comboBox.setSelectedIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
private void populateSettings(){
|
private void populateSettings(){
|
||||||
txtRouterIP.setText(_conf.getConf("server.hostname", "127.0.0.1"));
|
txtRouterIP.setText(_conf.getConf("server.hostname", "127.0.0.1"));
|
||||||
txtRouterPort.setText(_conf.getConf("server.port", 7650)+"");
|
txtRouterPort.setText(_conf.getConf("server.port", 7650)+"");
|
||||||
passwordField.setText(_conf.getConf("server.password", "itoopie"));
|
passwordField.setText(_conf.getConf("server.password", "itoopie"));
|
||||||
|
|
||||||
|
GetI
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
@ -328,7 +358,7 @@ public class SettingsFrame extends RegisteredFrame{
|
|||||||
String portText = txtRouterPort.getText();
|
String portText = txtRouterPort.getText();
|
||||||
String pwText = new String(passwordField.getPassword());
|
String pwText = new String(passwordField.getPassword());
|
||||||
|
|
||||||
// // Exit SAVE_STATUS.NO_CHANGES if no changes are found. Possibly just a annoying check.
|
// // Exit SAVE_STATUS.NO_CHANGES if no changes are found. Possibly just an annoying check.
|
||||||
// if (ipText.equals(oldIP) && portText.equals(oldPort+"") && pwText.equals(oldPW))
|
// if (ipText.equals(oldIP) && portText.equals(oldPort+"") && pwText.equals(oldPW))
|
||||||
// return LOCAL_SAVE_STATUS.NO_CHANGES;
|
// return LOCAL_SAVE_STATUS.NO_CHANGES;
|
||||||
|
|
||||||
|
65
src/net/i2p/itoopie/i2pcontrol/methods/GetI2PControl.java
Normal file
65
src/net/i2p/itoopie/i2pcontrol/methods/GetI2PControl.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package net.i2p.itoopie.i2pcontrol.methods;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
|
||||||
|
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
|
||||||
|
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||||
|
import net.i2p.itoopie.i2pcontrol.UnrecoverableFailedRequestException;
|
||||||
|
import net.i2p.itoopie.i2pcontrol.methods.I2PControl.I2P_CONTROL;
|
||||||
|
|
||||||
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
|
||||||
|
import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||||
|
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||||
|
|
||||||
|
public class GetI2PControl {
|
||||||
|
private final static Log _log = LogFactory.getLog(GetI2PControl.class);
|
||||||
|
|
||||||
|
|
||||||
|
public static EnumMap<I2P_CONTROL, Object> execute(I2P_CONTROL ... settings)
|
||||||
|
throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException{
|
||||||
|
|
||||||
|
JSONRPC2Request req = new JSONRPC2Request("I2PControl", JSONRPC2Interface.incrNonce());
|
||||||
|
|
||||||
|
Map outParams = new HashMap();
|
||||||
|
|
||||||
|
for (I2P_CONTROL s : settings){
|
||||||
|
if(s.isReadable()){
|
||||||
|
outParams.put(s.toString(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
req.setParams(outParams);
|
||||||
|
|
||||||
|
JSONRPC2Response resp = null;
|
||||||
|
try {
|
||||||
|
resp = JSONRPC2Interface.sendReq(req);
|
||||||
|
HashMap map = (HashMap) resp.getResult();
|
||||||
|
if (map != null){
|
||||||
|
Set<Entry> inputSet = map.entrySet();
|
||||||
|
EnumMap<I2P_CONTROL, Object> output = new EnumMap<I2P_CONTROL, Object>(I2P_CONTROL.class);
|
||||||
|
// Present the result as an <Enum,Object> map.
|
||||||
|
for (Entry e: inputSet){
|
||||||
|
String key = (String) e.getKey();
|
||||||
|
I2P_CONTROL I2PC = I2PControl.getEnum(key);
|
||||||
|
// If the enum exists. They should exists, but safety first.
|
||||||
|
if (I2PC != null){
|
||||||
|
output.put(I2PC, e.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
} else {
|
||||||
|
return new EnumMap<I2P_CONTROL, Object>(I2P_CONTROL.class);
|
||||||
|
}
|
||||||
|
} catch (UnrecoverableFailedRequestException e) {
|
||||||
|
_log.error("getI2PControl failed.", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -24,7 +24,7 @@ public class I2PControl{
|
|||||||
public boolean isWritable(){ return true;}
|
public boolean isWritable(){ return true;}
|
||||||
public String toString() { return "i2pcontrol.port"; }},
|
public String toString() { return "i2pcontrol.port"; }},
|
||||||
|
|
||||||
ADDRESS { public boolean isReadable(){ return false;}
|
ADDRESS { public boolean isReadable(){ return false;}
|
||||||
public boolean isWritable(){ return true;}
|
public boolean isWritable(){ return true;}
|
||||||
public String toString() { return "i2pcontrol.address"; }}
|
public String toString() { return "i2pcontrol.address"; }}
|
||||||
|
|
||||||
|
@ -46,10 +46,10 @@ public class ReseedMonitor extends TimerTask{
|
|||||||
Boolean isReseeding = (Boolean) em.get(ROUTER_INFO.IS_RESEEDING);
|
Boolean isReseeding = (Boolean) em.get(ROUTER_INFO.IS_RESEEDING);
|
||||||
if (knownPeers != null && isReseeding != null){
|
if (knownPeers != null && isReseeding != null){
|
||||||
if (knownPeers < MIN_KNOWN_PEERS){
|
if (knownPeers < MIN_KNOWN_PEERS){
|
||||||
|
_log.info("Few peers detected, initiating reseed..");
|
||||||
HashMap<ROUTER_MANAGER, String> hm = new HashMap<ROUTER_MANAGER, String>();
|
HashMap<ROUTER_MANAGER, String> hm = new HashMap<ROUTER_MANAGER, String>();
|
||||||
hm.put(ROUTER_MANAGER.RESEED, null);
|
hm.put(ROUTER_MANAGER.RESEED, null);
|
||||||
SetRouterManager.execute(hm);
|
SetRouterManager.execute(hm);
|
||||||
_log.info("Reseed initiated..");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InvalidPasswordException e) {
|
} catch (InvalidPasswordException e) {
|
||||||
|
Reference in New Issue
Block a user