Skip to content

Commit

Permalink
Merge branch 'next' of https://github.com/freenet/fred into HashingAPI
Browse files Browse the repository at this point in the history
Conflicts:
	src/freenet/crypt/HashResult.java
  • Loading branch information
unixninja92 committed Mar 22, 2015
2 parents f0b5d57 + 9e580de commit d7031ea
Show file tree
Hide file tree
Showing 669 changed files with 45,355 additions and 39,227 deletions.
3 changes: 2 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<classpathentry including="freenet/|org/" kind="src" output="build/test" path="test"/>
<classpathentry kind="lib" path="/usr/share/java/junit.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/freenet/freenet-ext.jar" sourcepath="/Contrib/db4o/src/db4oj"/>
<classpathentry exported="true" kind="lib" path="lib/freenet/freenet-ext.jar" sourcepath="/Contrib/db4o/src/db4oj"/>
<classpathentry kind="lib" path="lib/bcprov.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="build/main/"/>
</classpath>
14 changes: 10 additions & 4 deletions README.building.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
## Building Freenet from source: Short version

Install junit 3 and Apache ant. For Debian Wheezy these are `junit` and `ant`.
Install junit 4, Apache ant and Hamcrest. For Debian Wheezy these are `junit4`, `ant`, `ant-optional` and `libhamcrest-java`.

* `lib/bcprov.jar`: Download Bouncy Castle 1.49 (1.50 breaks something currently): `wget --no-passive-ftp ftp://ftp.bouncycastle.org/pub/release1.49/bcprov-jdk15on-149.jar` or `wget http://www.bouncycastle.org/download/bcprov-jdk15on-149.jar`
* `lib/freenet/freenet-ext.jar`: Build the `contrib/` submodule or [download](https://downloads.freenetproject.org/alpha/freenet-ext.jar) for convenience.
If sufficient packages are not available, put these jars into the `lib/` directory:

* `junit4.jar` and `hamcrest-core.jar`: See the [download instructions](https://github.com/junit-team/junit/wiki/Download-and-Install)
* `bcprov-jdk15on-151.jar`: Download Bouncy Castle 1.51: `wget --no-passive-ftp ftp://ftp.bouncycastle.org/pub/release1.51/bcprov-jdk15on-151.jar` or `wget http://www.bouncycastle.org/download/bcprov-jdk15on-151.jar`

Freenet also requires in the `lib/freenet/` directory:

* `freenet-ext.jar`: Build the `contrib/` submodule or [download](https://downloads.freenetproject.org/latest/freenet-ext.jar) for convenience.

The dependencies could also be copied from an existing Freenet installation.

Expand All @@ -24,7 +30,7 @@ _Configure the Build Path_, removing the obsolete JRE_LIB link and

#### Older versions of Eclipse ####

You may need to add the two jars, and junit 3, to the build path for the project, although the .project might help with this.
You may need to add the two jars, and junit 4, to the build path for the project, although the .project might help with this.

### Building Freenet from source: Caveats

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ location-based services (geo.enabled) and GoBrowsing (keyword.enabled) in firefo
probably a number of plugins. Note that this is not unique to Firefox - until version 9
or so, Internet Explorer had much worse problems. The most fundamental thing is browser
history probing via CSS. This can be turned off globally and will improve your privacy,
see e.g. http://whattheinternetknowsaboutyou.com/ - but it is probably still safer to
but it is probably still safer to
use a separate browser, and the fact that you have turned it off will likely be
detectable. If you do use a separate browser, you can do some helpful tricks such as
turning off javascript, not loading any addons or plugins, turning off the cache and
Expand Down Expand Up @@ -152,7 +152,7 @@ few other classes from the 0.5 source.
- Freenet now uses 32kB fixed block sizes, to improve performance and simplify
the code.
- The Freenet Client Protocol is completely different, see the spec here:
http://wiki.freenetproject.org/FreenetFCPSpec2Point0
https://wiki.freenetproject.org/FCPv2
- Many more changes...

## LICENSING
Expand Down
25 changes: 17 additions & 8 deletions build-clean.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ maintainers may prefer to use this instead of build.xml.
<path id="lib.path">
<fileset dir="${lib.contrib.dir}" includes="${lib.contrib.jars}"/>
<fileset dir="${lib.dir}" includes="${lib.jars}"/>
<fileset dir="/usr/share/java" includes="${lib.jars}" erroronmissingdir="false"/>
</path>
<path id="libtest.path">
<path refid="lib.path"/>
<fileset dir="${lib.dir}" includes="${libtest.jars}"/>
<fileset dir="/usr/share/java" includes="${libtest.jars}" erroronmissingdir="false"/>
<pathelement path="${main.make}"/>
<pathelement path="${test.make}"/>
</path>
Expand Down Expand Up @@ -159,8 +161,9 @@ maintainers may prefer to use this instead of build.xml.

<target name="env">
<available property="lib.contrib.present" classname="freenet.node.ExtVersion" classpathref="lib.path"/>
<available property="lib.bouncycastle.present" classname="org.bouncycastle.jce.provider.BouncyCastleProvider" classpathref="lib.path"/>
<available property="lib.junit.present" classname="junit.framework.Test" classpathref="libtest.path"/>
<available property="lib.bouncycastle.present" classname="org.bouncycastle.crypto.SkippingStreamCipher" classpathref="lib.path"/>
<available property="lib.junit.present" classname="org.junit.runners.JUnit4" classpathref="libtest.path"/>
<available property="lib.hamcrest.present" classname="org.hamcrest.SelfDescribing" classpathref="libtest.path"/>
<available property="lib.findbugs.present" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.path}"/>
<available property="lib.pmd.present" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
<available property="lib.cpd.present" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="pmd.classpath"/>
Expand All @@ -179,11 +182,15 @@ maintainers may prefer to use this instead of build.xml.
</target>

<target name="libdep-bc" depends="env" unless="lib.bouncycastle.present">
<fail message="Please download the Bouncycastle crypto library from www.bouncycastle.org and put it in lib/bcprov.jar"/>
<fail message="Bouncycastle not available (or not recent enough); try https://downloads.freenetproject.org/latest/${bc.jar}"/>
</target>

<target name="libdep-junit" depends="env" unless="lib.junit.present">
<fail message="JUnit not available"/>
<fail message="JUnit4 not available"/>
</target>

<target name="libdep-hamcrest" depends="env" unless="lib.hamcrest.present">
<fail message="Hamcrest-core not available"/>
</target>

<target name="libdep-findbugs" depends="env" unless="lib.findbugs.present">
Expand Down Expand Up @@ -276,15 +283,16 @@ maintainers may prefer to use this instead of build.xml.
<property name="lib.contrib.loc" location="${lib.contrib.dir}" />
<property name="lib.loc" location="${lib.dir}" />
<pathconvert property="lib.jars.package" refid="lib.path" pathsep=" ">
<map from="${lib.contrib.loc}/" to="${lib.contrib.dir.rel}/"/>
<map from="${lib.contrib.loc}/" to=""/>
<map from="${lib.loc}/" to=""/>
</pathconvert>
<jar jarfile="${jar.dst}" basedir="${main.make}">
<manifest>
<attribute name="Main-Class" value="freenet.node.Node"/>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Application-Name" value="Freenet REference Daemon"/>

<attribute name="Required-Ext-Version" value="29"/>
<attribute name="Recommended-Ext-Version" value="29"/>
<attribute name="Class-Path" value="${lib.jars.package}" />
<section name="common">
<attribute name="Specification-Title" value="Freenet"/>
<attribute name="Specification-Version" value="0.7.5"/>
Expand All @@ -302,7 +310,8 @@ maintainers may prefer to use this instead of build.xml.

<target name="unit-build" depends="build" unless="${test.skip}">
<antcall target="libdep-junit"/>
<javac srcdir="${test.src}" destdir="${test.make}" debug="on" source="1.6" target="1.6" encoding="UTF-8">
<antcall target="libdep-hamcrest"/>
<javac srcdir="${test.src}" destdir="${test.make}" debug="on" source="1.6" target="1.6" includeAntRuntime="false" encoding="UTF-8">
<compilerarg line="${javac.args}"/>
<classpath refid="libtest.path"/>
<include name="**/*.java"/>
Expand Down
6 changes: 3 additions & 3 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ doc.api=javadoc

# dir for common library jars
lib.dir = lib
#lib.dir = /usr/share/java

# dir for freenet library jars (aka freenet-ext or "contrib" jars)
lib.contrib.dir = lib/freenet
Expand All @@ -43,11 +42,12 @@ lib.contrib.dir = lib/freenet
lib.contrib.dir.rel = freenet

# jars from ${lib.dir} to use
lib.jars = bcprov.jar
bc.jar = bcprov-jdk15on-151.jar
lib.jars = ${bc.jar}
#lib.jars = wrapper.jar db-je.jar bdb-je.jar commons-compress.jar

# jars from ${lib.dir} to use, for tests
libtest.jars = junit.jar
libtest.jars = junit4.jar hamcrest-core.jar

# jars from ${lib.contrib.dir} to use
lib.contrib.jars = freenet-ext.jar bitcollider-core.jar db4o.jar lzmajio.jar mantissa.jar \
Expand Down
10 changes: 5 additions & 5 deletions dependencies.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ contrib.key=CHK@6xW9CyMrm9fVoHfQL4j8~O2BBNzJt0N3HywffP2O1t4,ozsCsUld9z~EUh5NFkZr
contrib.size=4685193
contrib.type=CLASSPATH
contrib.order=1
bouncycastle.version=1.49.0
bouncycastle.filename=bcprov-jdk15on-149.jar
bouncycastle.sha256=96b4b8d46e38e5a08b5ee6eec23c5951d95bdac35c08f935e999bbbe6b15ba9d
bouncycastle.version=1.51.0
bouncycastle.filename=bcprov-jdk15on-151.jar
bouncycastle.sha256=8748f0ec73895f7f18c1a9c13cf754fddddf0451cf472463ef02f93c3e7a7de7
bouncycastle.filename-regex=bcprov-jdk.*.jar
bouncycastle.key=CHK@W524lejrrtFrRlCH19xINNOpo0WvL1ICuowK2c1Ulxo,pWtP574xK1Zh4ImS4dBLJZBnFsuO-tqdEHRaDKXbHn8,AAMC--8/bcprov-jdk15on-149.jar
bouncycastle.size=2476362
bouncycastle.key=CHK@NXh1PE7EYXomGpucXcwKhvbNoarWzAmwx9TlqiMUjQI,3-d-RHdmB9CahXIGf8RdrtLzbJ843jxEyRrQCYYCrQE,AAMC--8/bcprov-jdk15on-151.jar
bouncycastle.size=2842667
bouncycastle.type=CLASSPATH
bouncycastle.order=-1
update-sh.version=1
Expand Down
42 changes: 17 additions & 25 deletions src/freenet/client/ArchiveContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
* http://www.gnu.org/ for further details of the GPL. */
package freenet.client;

import java.io.Serializable;
import java.util.HashSet;

import com.db4o.ObjectContainer;

import freenet.keys.FreenetURI;

/**
Expand All @@ -15,11 +14,14 @@
* Object passed down a full fetch, including all the recursion.
* Used, at present, for detecting archive fetch loops, hence the
* name.
*
* WARNING: Changing non-transient members on classes that are Serializable can result in
* restarting downloads or losing uploads.
*/
// WARNING: THIS CLASS IS STORED IN DB4O -- THINK TWICE BEFORE ADD/REMOVE/RENAME FIELDS
public class ArchiveContext {
public class ArchiveContext implements Serializable {

private HashSet<FreenetURI> soFar;
private static final long serialVersionUID = 1L;
private HashSet<FreenetURI> soFar;
final int maxArchiveLevels;
final long maxArchiveSize;

Expand All @@ -28,40 +30,30 @@ public ArchiveContext(long maxArchiveSize, int max) {
this.maxArchiveSize = maxArchiveSize;
}

protected ArchiveContext() {
// For serialization.
maxArchiveLevels = 0;
maxArchiveSize = 0;
}

/**
* Check for a loop.
*
* The URI provided is expected to be a reasonably unique identifier for the archive.
*/
public synchronized void doLoopDetection(FreenetURI key, ObjectContainer container) throws ArchiveFailureException {
if(container != null)
container.activate(soFar, Integer.MAX_VALUE);
public synchronized void doLoopDetection(FreenetURI key) throws ArchiveFailureException {
if(soFar == null) {
soFar = new HashSet<FreenetURI>();
if(container != null)
container.store(soFar);
}
if(soFar.size() > maxArchiveLevels)
throw new ArchiveFailureException(ArchiveFailureException.TOO_MANY_LEVELS);
FreenetURI uri = key;
if(container != null)
uri = uri.clone();
if(!soFar.add(uri)) {
throw new ArchiveFailureException(ArchiveFailureException.ARCHIVE_LOOP_DETECTED);
}
if(container != null) {
container.store(uri);
container.store(soFar);
}
}

public void removeFrom(ObjectContainer container) {
if(soFar != null) {
for(FreenetURI uri : soFar) {
uri.removeFrom(container);
}
container.delete(soFar);
}
container.delete(this);
}
public synchronized void clear() {
soFar = null;
}
}
14 changes: 6 additions & 8 deletions src/freenet/client/ArchiveExtractCallback.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
package freenet.client;

import com.db4o.ObjectContainer;
import java.io.Serializable;

import freenet.client.async.ClientContext;
import freenet.support.api.Bucket;

/** Called when we have extracted an archive, and a specified file either is
* or isn't in it. */
public interface ArchiveExtractCallback {
public interface ArchiveExtractCallback extends Serializable {

/** Got the data.
* Note that the bucket will be persistent if the caller asked for an off-thread extraction. */
public void gotBucket(Bucket data, ObjectContainer container, ClientContext context);
public void gotBucket(Bucket data, ClientContext context);

/** Not in the archive */
public void notInArchive(ObjectContainer container, ClientContext context);
public void notInArchive(ClientContext context);

/** Failed: restart */
public void onFailed(ArchiveRestartException e, ObjectContainer container, ClientContext context);
public void onFailed(ArchiveRestartException e, ClientContext context);

/** Failed for some other reason */
public void onFailed(ArchiveFailureException e, ObjectContainer container, ClientContext context);
public void onFailed(ArchiveFailureException e, ClientContext context);

public void removeFrom(ObjectContainer container);

}
61 changes: 0 additions & 61 deletions src/freenet/client/ArchiveExtractTag.java

This file was deleted.

Loading

0 comments on commit d7031ea

Please sign in to comment.