Update of /cvsroot/freenet/freenet/src/freenet/session
In directory sc8-pr-cvs1:/tmp/cvs-serv25857/src/freenet/session
Modified Files:
Tag: stable
FnpLink.java FnpLinkManager.java Link.java PlainLink.java
Log Message:
5029: Merge from unstable after months of work. MASSIVE changes.
Highlights:
* Next Generation Routing, massive related changes
* Major changes to handling of messages and connections (PeerHandler and related
changes)
* Even more non-blocking I/O
* Documentation improvements
* Lots of new diagnostics and config options
* Lots of bug fixes and performance tweaking
* Probably lots of new bugs too!
Index: FnpLink.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/session/FnpLink.java,v
retrieving revision 1.14.2.4.2.6
retrieving revision 1.14.2.4.2.7
diff -u -w -r1.14.2.4.2.6 -r1.14.2.4.2.7
--- FnpLink.java 23 Jul 2003 01:56:53 -0000 1.14.2.4.2.6
+++ FnpLink.java 28 Oct 2003 20:20:44 -0000 1.14.2.4.2.7
@@ -22,7 +22,7 @@
protected InputStream in;
- protected OutputStream out;
+ protected CipherOutputStream out;
protected AdapterOutputStream innerOut;
protected AdapterInputStream innerIn;
protected Connection conn;
@@ -42,7 +42,7 @@
protected FnpLink(FnpLinkManager flm, Connection c) {
linkManager = flm;
conn = c;
- logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
//profiling
//WARNING:remove before release
synchronized(profLock) {
@@ -227,7 +227,7 @@
shiftedSetTime, sstlen>500?Logger.MINOR:
Logger.DEBUG);
- BigInteger[] C = asymCipher.encrypt(bob, M, Core.randSource);
+ BigInteger[] C = asymCipher.encrypt(bob, M, Core.getRandSource());
long madeChallengeTime = System.currentTimeMillis();
long mclen = madeChallengeTime - shiftedSetTime;
@@ -279,7 +279,7 @@
rbl>500?Logger.MINOR:Logger.DEBUG);
if (cb == SILENT_BOB_BYTE) {
- ctx.writeIV(Core.randSource, rawOut);
+ ctx.writeIV(Core.getRandSource(), rawOut);
long writtenIVTime = System.currentTimeMillis();
long ivt = writtenIVTime - readByteTime;
if(logDEBUG || ivt>500)
@@ -310,7 +310,7 @@
"Bad OK byte");
}
} else {
- ctx.writeIV(Core.randSource, rawOut);
+ ctx.writeIV(Core.getRandSource(), rawOut);
long writtenIVTime = System.currentTimeMillis();
long wiv = writtenIVTime - initCipherTime;
if(logDEBUG || wiv>500)
@@ -415,7 +415,7 @@
Core.logger.log(this, "Set up cipher in "+clen, clen>500?
Logger.MINOR:Logger.DEBUG);
- ctx.writeIV(Core.randSource, rawOut);
+ ctx.writeIV(Core.getRandSource(), rawOut);
long IVTime = System.currentTimeMillis();
long ivlen = IVTime - cipherTime;
if(logDEBUG || ivlen>500)
@@ -499,7 +499,7 @@
}
PCFBMode pcfb = new PCFBMode(c);
- pcfb.writeIV(Core.randSource, rawOut);
+ pcfb.writeIV(Core.getRandSource(), rawOut);
setOutputStream(pcfb, rawOut);
//setInputStream(c, rawIn);
@@ -510,7 +510,7 @@
ctx.update(Cbbytes, 0, Cbbytes.length);
BigInteger M = Util.byteArrayToMPI(ctx.digest());
DSASignature sigCaCb = DSA.sign(pubMe.getGroup(), privMe,
- M, Core.randSource);
+ M, Core.getRandSource());
sigCaCb.write(out);
out.flush();
@@ -575,7 +575,7 @@
ByteArrayOutputStream buff = new ByteArrayOutputStream(10000);
- DLESCa = asymCipher.encrypt(bob, Ca, Core.randSource);
+ DLESCa = asymCipher.encrypt(bob, Ca, Core.getRandSource());
long encryptedTime = System.currentTimeMillis();
long elen = encryptedTime - writtenByteTime;
if(logDEBUG || elen>500)
@@ -637,7 +637,7 @@
Core.logger.log(this, "Initialized more cipher stuff in "+ilen, ilen>500?
Logger.MINOR:Logger.DEBUG);
- pcfb.writeIV(Core.randSource, rawOut);
+ pcfb.writeIV(Core.getRandSource(), rawOut);
long writtenIVTime = System.currentTimeMillis();
long wivlen = writtenIVTime - inittedBitsTime;
if(logDEBUG || wivlen>500)
@@ -664,7 +664,7 @@
M = Util.byteArrayToMPI(ctx.digest());
DSASignature sigYaCaCb = DSA.sign(pubMe.getGroup(), privMe, M,
- Core.randSource);
+ Core.getRandSource());
long signedTime = System.currentTimeMillis();
long siglen = signedTime - writtenPKTime;
if(logDEBUG || siglen>500)
@@ -787,6 +787,16 @@
}
}
+ public void encryptBytes(byte[] buf, int offset, int length)
+ throws IOException {
+ CipherOutputStream os = out;
+ if(os == null)
+ throw new IOException("already closed!");
+ PCFBMode ctx = os.getCipher();
+ if(ctx != null)
+ ctx.blockEncipher(buf, offset, length);
+ }
+
// FIXME: neither of these should be inner classes
protected class AdapterOutputStream extends FilterOutputStream {
@@ -859,7 +869,8 @@
}
public InputStream makeInputStream(InputStream is) {
- innerIn.setIn(is);
+ if(innerIn != null) innerIn.setIn(is);
+ else return null;
return getInputStream();
}
Index: FnpLinkManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/session/FnpLinkManager.java,v
retrieving revision 1.5.4.7.2.4
retrieving revision 1.5.4.7.2.5
diff -u -w -r1.5.4.7.2.4 -r1.5.4.7.2.5
--- FnpLinkManager.java 29 Jul 2003 21:08:08 -0000 1.5.4.7.2.4
+++ FnpLinkManager.java 28 Oct 2003 20:20:45 -0000 1.5.4.7.2.5
@@ -67,7 +67,7 @@
Identity bob,
Connection c) throws CommunicationException {
long startTime = System.currentTimeMillis();
- boolean logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
if(logDEBUG)
Core.logger.log(this, "createOutgoing() at "+startTime,
Core.logger.DEBUG);
@@ -172,7 +172,7 @@
LinkToken lt=new FnpLinkToken(remotePK, me, k, linkIdentifier);
//Core.logger.log(this, "Adding link identified by "
// + linkIdentifier.toString(16), Core.logger.DEBUG);
- if(Core.logger.shouldLog(Logger.DEBUG)) Core.logger.log(this, "Adding link to
peer " + remotePK,
+ if(Core.logger.shouldLog(Logger.DEBUG,this)) Core.logger.log(this, "Adding
link to peer " + remotePK,
Core.logger.DEBUG);
Core.diagnostics.occurrenceCounting("liveLinks", 1);
synchronized (this) {
Index: Link.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/session/Link.java,v
retrieving revision 1.1.1.1.6.1
retrieving revision 1.1.1.1.6.2
diff -u -w -r1.1.1.1.6.1 -r1.1.1.1.6.2
--- Link.java 1 Jul 2003 02:27:17 -0000 1.1.1.1.6.1
+++ Link.java 28 Oct 2003 20:20:45 -0000 1.1.1.1.6.2
@@ -82,12 +82,18 @@
*/
public LinkManager getManager();
- /*
+ /**
+ * Encrypt some bytes in-place for transmission in order
+ */
+ public void encryptBytes(byte[] data, int offset, int length)
+ throws IOException;
+
+ /**
* Wrap the (raw) InputStream given
*/
public InputStream makeInputStream(InputStream is);
- /*
+ /**
* Wrap the (raw) OutputStream given
*/
public OutputStream makeOutputStream(OutputStream os);
Index: PlainLink.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/session/PlainLink.java,v
retrieving revision 1.1.1.1.6.1
retrieving revision 1.1.1.1.6.2
diff -u -w -r1.1.1.1.6.1 -r1.1.1.1.6.2
--- PlainLink.java 1 Jul 2003 02:27:17 -0000 1.1.1.1.6.1
+++ PlainLink.java 28 Oct 2003 20:20:45 -0000 1.1.1.1.6.2
@@ -105,6 +105,10 @@
return is;
}
+ public void encryptBytes(byte[] b, int offset, int length) {
+ // Do nothing!
+ }
+
/**
* Does nothing!
*/
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs