I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 18c023e6 authored by walking's avatar walking
Browse files

merge of '6c2ef00502207c28f02c90cef00b19d75f09d9a4'

     and 'de35fdcdc8943537c71571c5c9d8320a24768cdf'
parents 1e83d1b3 312ba259
No related branches found
No related tags found
No related merge requests found
...@@ -89,6 +89,24 @@ ...@@ -89,6 +89,24 @@
<!-- jar again to get the latest messages_*.class files --> <!-- jar again to get the latest messages_*.class files -->
<jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" /> <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
</target> </target>
<target name="poupdate" depends="compile">
<ant target="war" />
<!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true -->
<exec executable="sh" osfamily="unix" failifexecutionfails="true" >
<arg value="./bundle-messages.sh" />
<arg value="-p" />
</exec>
<exec executable="sh" osfamily="mac" failifexecutionfails="true" >
<arg value="./bundle-messages.sh" />
<arg value="-p" />
</exec>
<exec executable="cmd" osfamily="windows" failifexecutionfails="true" >
<arg value="/c" />
<arg value="bundle-messages.bat" />
<arg value="-p" />
</exec>
</target>
<target name="war" depends="precompilejsp"> <target name="war" depends="precompilejsp">
<!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ --> <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
<war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml" <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
......
...@@ -2,12 +2,22 @@ ...@@ -2,12 +2,22 @@
# Update messages_xx.po and messages_xx.class files, # Update messages_xx.po and messages_xx.class files,
# from both java and jsp sources. # from both java and jsp sources.
# Requires installed programs xgettext, msgfmt, msgmerge, and find. # Requires installed programs xgettext, msgfmt, msgmerge, and find.
#
# usage:
# bundle-messages.sh (generates the resource bundle from the .po file)
# bundle-messages.sh -p (updates the .po file from the source tags, then generates the resource bundle)
#
# zzz - public domain # zzz - public domain
# #
CLASS=net.i2p.router.web.messages CLASS=net.i2p.router.web.messages
TMPFILE=build/javafiles.txt TMPFILE=build/javafiles.txt
export TZ=UTC export TZ=UTC
if [ "$1" = "-p" ]
then
POUPDATE=1
fi
# #
# generate strings/Countries.java from ../../../installer/resources/countries.txt # generate strings/Countries.java from ../../../installer/resources/countries.txt
# #
...@@ -37,8 +47,12 @@ do ...@@ -37,8 +47,12 @@ do
LG=${i#../locale/messages_} LG=${i#../locale/messages_}
LG=${LG%.po} LG=${LG%.po}
# make list of java files newer than the .po file if [ "$POUPDATE" = "1" ]
find $JPATHS -name *.java -newer $i > $TMPFILE then
# make list of java files newer than the .po file
find $JPATHS -name *.java -newer $i > $TMPFILE
fi
if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a \ if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a \
build/obj/net/i2p/router/web/messages_$LG.class -nt $i -a \ build/obj/net/i2p/router/web/messages_$LG.class -nt $i -a \
! -s $TMPFILE ] ! -s $TMPFILE ]
...@@ -46,42 +60,46 @@ do ...@@ -46,42 +60,46 @@ do
continue continue
fi fi
echo "Generating ${CLASS}_$LG ResourceBundle..." if [ "$POUPDATE" = "1" ]
# extract strings from java and jsp files, and update messages.po files
# translate calls must be one of the forms:
# _("foo")
# _x("foo")
# intl._("foo")
# intl.title("foo")
# handler._("foo")
# formhandler._("foo")
# net.i2p.router.web.Messages.getString("foo")
# In a jsp, you must use a helper or handler that has the context set.
# To start a new translation, copy the header from an old translation to the new .po file,
# then ant distclean updater.
find $JPATHS -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java --from-code=UTF-8 \
--keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \
--keyword=handler._ --keyword=formhandler._ \
--keyword=net.i2p.router.web.Messages.getString \
-o ${i}t
if [ $? -ne 0 ]
then then
echo 'Warning - xgettext failed, not updating translations' echo "Updating the $i file from the tags..."
# extract strings from java and jsp files, and update messages.po files
# translate calls must be one of the forms:
# _("foo")
# _x("foo")
# intl._("foo")
# intl.title("foo")
# handler._("foo")
# formhandler._("foo")
# net.i2p.router.web.Messages.getString("foo")
# In a jsp, you must use a helper or handler that has the context set.
# To start a new translation, copy the header from an old translation to the new .po file,
# then ant distclean updater.
find $JPATHS -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java --from-code=UTF-8 \
--keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \
--keyword=handler._ --keyword=formhandler._ \
--keyword=net.i2p.router.web.Messages.getString \
-o ${i}t
if [ $? -ne 0 ]
then
echo 'Warning - xgettext failed, not updating translations'
rm -f ${i}t
break
fi
msgmerge -U --backup=none $i ${i}t
if [ $? -ne 0 ]
then
echo 'Warning - msgmerge failed, not updating translations'
rm -f ${i}t
break
fi
rm -f ${i}t rm -f ${i}t
break # so we don't do this again
touch $i
fi fi
msgmerge -U --backup=none $i ${i}t
if [ $? -ne 0 ] echo "Generating ${CLASS}_$LG ResourceBundle..."
then
echo 'Warning - msgmerge failed, not updating translations'
rm -f ${i}t
break
fi
rm -f ${i}t
# so we don't do this again
touch $i
# convert to class files in build/obj # convert to class files in build/obj
msgfmt --java -r $CLASS -l $LG -d build/obj $i msgfmt --java -r $CLASS -l $LG -d build/obj $i
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<echo message=" pkgWithDesktopgui: distclean then package everything up with the desktopgui" /> <echo message=" pkgWithDesktopgui: distclean then package everything up with the desktopgui" />
<echo message=" distWithDesktopgui: pkgWithDesktopgui and javadoc" /> <echo message=" distWithDesktopgui: pkgWithDesktopgui and javadoc" />
<echo message=" distcleanWithDesktopgui: clean up all derived files (including desktopgui files)" /> <echo message=" distcleanWithDesktopgui: clean up all derived files (including desktopgui files)" />
<echo message=" poupdate: update the .po files for translators" />
</target> </target>
<target name="debianhowto"> <target name="debianhowto">
<echo message="To build debian packages, you must run dpkg-buildpackage as root in the source directory. It will then run ant for you. dpkg-buildpackage is found in the 'dpkg-dev' package. Also it should work fine to use the 'fakeroot' package with dpkg-buildpackage, if you don't want to run as root. Please read 'man dpkg-buildpackage' before building any packages yourself." /> <echo message="To build debian packages, you must run dpkg-buildpackage as root in the source directory. It will then run ant for you. dpkg-buildpackage is found in the 'dpkg-dev' package. Also it should work fine to use the 'fakeroot' package with dpkg-buildpackage, if you don't want to run as root. Please read 'man dpkg-buildpackage' before building any packages yourself." />
...@@ -138,6 +139,9 @@ ...@@ -138,6 +139,9 @@
<copy file="installer/lib/jbigi/jbigi.jar" todir="build" /> <copy file="installer/lib/jbigi/jbigi.jar" todir="build" />
<copy file="apps/addressbook/dist/addressbook.war" todir="build/" /> <copy file="apps/addressbook/dist/addressbook.war" todir="build/" />
</target> </target>
<target name="poupdate">
<ant dir="apps/routerconsole/java/" target="poupdate" />
</target>
<target name="javadoc"> <target name="javadoc">
<mkdir dir="./build" /> <mkdir dir="./build" />
<mkdir dir="./build/javadoc" /> <mkdir dir="./build/javadoc" />
......
2009-11-18 zzz
* Build: Don't update the po files by default, add new
target "poupdate" to do that.
* Netdb:
- Floodfill rework part 3 of N: Send closest-to-the-key
in DSRM replies
- Adjust criteria for following DSRM
- Note failed floods in the profile
- Reduce max flood
2009-11-16 zzz 2009-11-16 zzz
* addressbook: Move class to net.i2p.addressbook * addressbook: Move class to net.i2p.addressbook
* build: Take two test scripts out of the installer * build: Take two test scripts out of the installer
......
...@@ -18,7 +18,7 @@ public class RouterVersion { ...@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 18; public final static long BUILD = 19;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA; public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
......
...@@ -99,7 +99,7 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad ...@@ -99,7 +99,7 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
} }
} }
private static final int MAX_TO_FLOOD = 9; private static final int MAX_TO_FLOOD = 7;
/** /**
* Send to a subset of all floodfill peers. * Send to a subset of all floodfill peers.
...@@ -139,6 +139,10 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad ...@@ -139,6 +139,10 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
m.setPriority(FLOOD_PRIORITY); m.setPriority(FLOOD_PRIORITY);
m.setTarget(target); m.setTarget(target);
m.setExpiration(_context.clock().now()+FLOOD_TIMEOUT); m.setExpiration(_context.clock().now()+FLOOD_TIMEOUT);
// note send failure but don't give credit on success
// might need to change this
Job floodFail = new FloodFailedJob(_context, peer);
m.setOnFailedSendJob(floodFail);
_context.commSystem().processMessage(m); _context.commSystem().processMessage(m);
flooded++; flooded++;
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
...@@ -149,6 +153,20 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad ...@@ -149,6 +153,20 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
_log.info("Flooded the data to " + flooded + " of " + peers.size() + " peers"); _log.info("Flooded the data to " + flooded + " of " + peers.size() + " peers");
} }
/** note in the profile that the store failed */
private static class FloodFailedJob extends JobImpl {
private Hash _peer;
public FloodFailedJob(RouterContext ctx, Hash peer) {
super(ctx);
_peer = peer;
}
public String getName() { return "Flood failed"; }
public void runJob() {
getContext().profileManager().dbStoreFailed(_peer);
}
}
private static final int FLOOD_PRIORITY = 200; private static final int FLOOD_PRIORITY = 200;
private static final int FLOOD_TIMEOUT = 30*1000; private static final int FLOOD_TIMEOUT = 30*1000;
......
...@@ -299,4 +299,16 @@ class FloodfillPeerSelector extends PeerSelector { ...@@ -299,4 +299,16 @@ class FloodfillPeerSelector extends PeerSelector {
} }
public int size() { return _matches; } public int size() { return _matches; }
} }
/**
* Floodfill peers only. Used only by HandleDatabaseLookupMessageJob to populate the DSRM.
*
* @param key the original key (NOT the routing key)
* @return List of Hash for the peers selected, ordered
*/
@Override
public List<Hash> selectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
Hash rkey = _context.routingKeyGenerator().getRoutingKey(key);
return selectFloodfillParticipants(rkey, maxNumRouters, peersToIgnore, kbuckets);
}
} }
package net.i2p.router.networkdb.kademlia; package net.i2p.router.networkdb.kademlia;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import net.i2p.data.RouterInfo;
import net.i2p.data.i2np.DatabaseSearchReplyMessage; import net.i2p.data.i2np.DatabaseSearchReplyMessage;
import net.i2p.router.JobImpl; import net.i2p.router.JobImpl;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
...@@ -10,7 +11,7 @@ import net.i2p.util.Log; ...@@ -10,7 +11,7 @@ import net.i2p.util.Log;
* Ask the peer who sent us the DSRM for the RouterInfos. * Ask the peer who sent us the DSRM for the RouterInfos.
* *
* If we have the routerInfo already, try to refetch it from that router itself, * If we have the routerInfo already, try to refetch it from that router itself,
* if we aren't already connected to that router, * (if the info is old or we don't think it is floodfill)
* which will help us establish that router as a good floodfill and speed our * which will help us establish that router as a good floodfill and speed our
* integration into the network. * integration into the network.
* *
...@@ -32,9 +33,13 @@ class SingleLookupJob extends JobImpl { ...@@ -32,9 +33,13 @@ class SingleLookupJob extends JobImpl {
Hash peer = _dsrm.getReply(i); Hash peer = _dsrm.getReply(i);
if (peer.equals(getContext().routerHash())) // us if (peer.equals(getContext().routerHash())) // us
continue; continue;
if (getContext().netDb().lookupRouterInfoLocally(peer) == null) if (peer.equals(from)) // wtf
continue;
RouterInfo ri = getContext().netDb().lookupRouterInfoLocally(peer);
if (ri == null)
getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, from)); getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, from));
else if (!getContext().commSystem().isEstablished(peer)) else if (ri.getPublished() < getContext().clock().now() - 60*60*1000 ||
!FloodfillNetworkDatabaseFacade.isFloodfill(ri))
getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, peer)); getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, peer));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment