forked from I2P_Developers/i2p.i2p
BOB fixes: Default Properties work, files are properly closed.
This commit is contained in:
@@ -35,9 +35,73 @@ import net.i2p.client.I2PClient;
|
|||||||
import net.i2p.client.streaming.RetransmissionTimer;
|
import net.i2p.client.streaming.RetransmissionTimer;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
import net.i2p.util.SimpleTimer;
|
import net.i2p.util.SimpleTimer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* <span style="font-size:8px;font-family:courier;color:#EEEEEE;background-color:#000000">
|
||||||
|
* ################################################################################<br>
|
||||||
|
* ############################.#..........#..#..........##########################<br>
|
||||||
|
* #######################......................................###################<br>
|
||||||
|
* ####################...........................#.......#........################<br>
|
||||||
|
* #################..................##...................#.........##############<br>
|
||||||
|
* ###############................###...####.....#..###.....#.........#############<br>
|
||||||
|
* #############...........###..#..###...#####...###.##........#.......############<br>
|
||||||
|
* ###########................#......##...#####...##..##.......#..#........########<br>
|
||||||
|
* ##########.........................#....##.##..#...##.....................######<br>
|
||||||
|
* #########...................................#....#.........................#####<br>
|
||||||
|
* ########.........................................#...............#..........####<br>
|
||||||
|
* ########.........................................#..........#######..........###<br>
|
||||||
|
* #######.................................................############..........##<br>
|
||||||
|
* #######..........................................####################.........##<br>
|
||||||
|
* #######............####################......########################.........##<br>
|
||||||
|
* ######.............###############################################.##.........##<br>
|
||||||
|
* ######............################################################..##........##<br>
|
||||||
|
* ######............################################################..##........##<br>
|
||||||
|
* ######.............##############################################..##.........##<br>
|
||||||
|
* ######............##############################################...##..........#<br>
|
||||||
|
* ######............#..###########################################...##..........#<br>
|
||||||
|
* ######.............#############################################....#..........#<br>
|
||||||
|
* #######...........###############################################..##.........##<br>
|
||||||
|
* #######...........#####.#.#.#.########################.....#.####...##........##<br>
|
||||||
|
* ######............#..............##################.................##.........#<br>
|
||||||
|
* ######................####.........###############........#####......##........#<br>
|
||||||
|
* ######..............####..#.........############.......##.#.######...##.......##<br>
|
||||||
|
* ######.................#.####.........########...........##....###...##.......##<br>
|
||||||
|
* #######....#....###...................#######...............#...###..##.......##<br>
|
||||||
|
* #######.........###..###.....###.......######.##.#####.........####..##.......##<br>
|
||||||
|
* #######.....#...##############.........############......###########.###......##<br>
|
||||||
|
* #######....##...##########.......##...##############......#.############.....###<br>
|
||||||
|
* ########....#..########......######...##################################....####<br>
|
||||||
|
* ########....##.####################...##################################....####<br>
|
||||||
|
* ########..#.##..###################..##################################..#..####<br>
|
||||||
|
* ##########..###..#################...##################################...#.####<br>
|
||||||
|
* #########....##...##############....########..#####.################.##..#.#####<br>
|
||||||
|
* ############.##....##########.......#########.###.......###########..#.#########<br>
|
||||||
|
* ###############.....#######...#.......########.....##.....######.....###########<br>
|
||||||
|
* ###############......###....##..........##.......######....#.........#.#########<br>
|
||||||
|
* ##############............##..................##########..............##########<br>
|
||||||
|
* ##############..............................##########..#.............##########<br>
|
||||||
|
* ###############.......##..................#####..............####....###########<br>
|
||||||
|
* ###############.......#####.......#.............####.....#######.....###########<br>
|
||||||
|
* ################...#...####......##################.....########....############<br>
|
||||||
|
* ################...##..#####.........####.##.....#....##########....############<br>
|
||||||
|
* ##################..##..####...........#####.#....############.....#############<br>
|
||||||
|
* ##################......#####.................################....##############<br>
|
||||||
|
* ###################.....####..........##########..###########....###############<br>
|
||||||
|
* ####################..#..#..........................########.....###############<br>
|
||||||
|
* #####################.##.......###.................########....#################<br>
|
||||||
|
* ######################.........#.......#.##.###############....#################<br>
|
||||||
|
* #############.#######...............#####################....###################<br>
|
||||||
|
* ###..#.....##...####..........#.....####################....####################<br>
|
||||||
|
* ####......##........................##################....######################<br>
|
||||||
|
* #.##...###..............###.........###############......#######################<br>
|
||||||
|
* #...###..##............######...........................########################<br>
|
||||||
|
* ##.......###..........##########....#...#...........############################<br>
|
||||||
|
* ##.........##.......############################################################<br>
|
||||||
|
* ###........##.....##############################################################<br>
|
||||||
|
* ####.............###############################################################<br>
|
||||||
|
* ######.........#################################################################<br>
|
||||||
|
* #########....###################################################################<br>
|
||||||
|
* ################################################################################<br>
|
||||||
|
* </span>
|
||||||
* BOB, main command socket listener, launches the command parser engine.
|
* BOB, main command socket listener, launches the command parser engine.
|
||||||
*
|
*
|
||||||
* @author sponge
|
* @author sponge
|
||||||
@@ -89,16 +153,19 @@ public class BOB {
|
|||||||
// This is here just to ensure there is no interference with our threadgroups.
|
// This is here just to ensure there is no interference with our threadgroups.
|
||||||
SimpleTimer Y = RetransmissionTimer.getInstance();
|
SimpleTimer Y = RetransmissionTimer.getInstance();
|
||||||
i = Y.hashCode();
|
i = Y.hashCode();
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
props.load(new FileInputStream(configLocation));
|
FileInputStream fi = new FileInputStream(configLocation);
|
||||||
} catch(FileNotFoundException fnfe) {
|
props.load(fi);
|
||||||
warn("Unable to load up the BOB config file " + configLocation + ", Using defaults.");
|
fi.close();
|
||||||
warn(fnfe.toString());
|
} catch(FileNotFoundException fnfe) {
|
||||||
save = true;
|
warn("Unable to load up the BOB config file " + configLocation + ", Using defaults.");
|
||||||
} catch(IOException ioe) {
|
warn(fnfe.toString());
|
||||||
warn("IOException on BOB config file " + configLocation + ", using defaults.");
|
save = true;
|
||||||
warn(ioe.toString());
|
} catch(IOException ioe) {
|
||||||
|
warn("IOException on BOB config file " + configLocation + ", using defaults.");
|
||||||
|
warn(ioe.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Global router and client API configurations that are missing are set to defaults here.
|
// Global router and client API configurations that are missing are set to defaults here.
|
||||||
if(!props.containsKey(I2PClient.PROP_TCP_HOST)) {
|
if(!props.containsKey(I2PClient.PROP_TCP_HOST)) {
|
||||||
@@ -131,7 +198,9 @@ public class BOB {
|
|||||||
if(save) {
|
if(save) {
|
||||||
try {
|
try {
|
||||||
warn("Writing new defaults file " + configLocation);
|
warn("Writing new defaults file " + configLocation);
|
||||||
props.store(new FileOutputStream(configLocation), configLocation);
|
FileOutputStream fo = new FileOutputStream(configLocation);
|
||||||
|
props.store(fo, configLocation);
|
||||||
|
fo.close();
|
||||||
} catch(IOException ioe) {
|
} catch(IOException ioe) {
|
||||||
warn("IOException on BOB config file " + configLocation + ", " + ioe);
|
warn("IOException on BOB config file " + configLocation + ", " + ioe);
|
||||||
}
|
}
|
||||||
|
@@ -151,7 +151,7 @@ public class doCMDS implements Runnable {
|
|||||||
*/
|
*/
|
||||||
doCMDS(Socket server, Properties props, nickname database, Log _log) {
|
doCMDS(Socket server, Properties props, nickname database, Log _log) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.props = props;
|
this.props = new Properties(props);
|
||||||
this.database = database;
|
this.database = database;
|
||||||
this._log = _log;
|
this._log = _log;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user