diff --git a/apps/routerconsole/java/src/net/i2p/router/web/StatHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/StatHelper.java
index d6d8ac905..ca5c447eb 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/StatHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/StatHelper.java
@@ -1,22 +1,37 @@
package net.i2p.router.web;
+import java.util.Iterator;
+import java.util.Set;
+
+import java.io.ByteArrayOutputStream;
+import java.io.Writer;
+
+import net.i2p.data.Hash;
+import net.i2p.router.RouterContext;
+
/**
* uuuugly. dump the peer profile data if given a peer.
*
*/
public class StatHelper {
private String _peer;
+ private Writer _writer;
+
public void setPeer(String peer) { _peer = peer; }
+ public void setWriter(Writer writer) { _writer = writer; }
+
public String getProfile() {
- net.i2p.router.RouterContext ctx = (net.i2p.router.RouterContext)net.i2p.router.RouterContext.listContexts().get(0);
- java.util.Set peers = ctx.profileOrganizer().selectAllPeers();
- for (java.util.Iterator iter = peers.iterator(); iter.hasNext(); ) {
- net.i2p.data.Hash peer = (net.i2p.data.Hash)iter.next();
- if (_peer.indexOf(peer.toBase64().substring(0,10)) >= 0) {
+ RouterContext ctx = (RouterContext)net.i2p.router.RouterContext.listContexts().get(0);
+ Set peers = ctx.profileOrganizer().selectAllPeers();
+ for (Iterator iter = peers.iterator(); iter.hasNext(); ) {
+ Hash peer = (Hash)iter.next();
+ if (peer.toBase64().startsWith(_peer)) {
try {
- java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(64*1024);
- ctx.profileOrganizer().exportProfile(peer, baos);
- return new String(baos.toByteArray());
+ WriterOutputStream wos = new WriterOutputStream(_writer);
+ ctx.profileOrganizer().exportProfile(peer, wos);
+ wos.flush();
+ _writer.flush();
+ return "";
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/WriterOutputStream.java b/apps/routerconsole/java/src/net/i2p/router/web/WriterOutputStream.java
new file mode 100644
index 000000000..0bc2baa66
--- /dev/null
+++ b/apps/routerconsole/java/src/net/i2p/router/web/WriterOutputStream.java
@@ -0,0 +1,17 @@
+package net.i2p.router.web;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * Treat a writer as an output stream. Quick 'n dirty, none
+ * of that "intarnasheeonaleyzayshun" stuff. So we can treat
+ * the jsp's PrintWriter as an OutputStream
+ */
+public class WriterOutputStream extends OutputStream {
+ private Writer _writer;
+
+ public WriterOutputStream(Writer writer) { _writer = writer; }
+ public void write(int b) throws IOException { _writer.write(b); }
+}
diff --git a/apps/routerconsole/jsp/dumpprofile.jsp b/apps/routerconsole/jsp/dumpprofile.jsp
index b8e5e9837..34ff35f7e 100644
--- a/apps/routerconsole/jsp/dumpprofile.jsp
+++ b/apps/routerconsole/jsp/dumpprofile.jsp
@@ -1,4 +1,5 @@
-<%@page contentType="text/plain" %>
-
-" />
-
\ No newline at end of file
+<%@page contentType="text/plain"
+%>"
+/>
\ No newline at end of file
diff --git a/apps/streaming/java/src/net/i2p/client/streaming/Connection.java b/apps/streaming/java/src/net/i2p/client/streaming/Connection.java
index 054113047..0edb615df 100644
--- a/apps/streaming/java/src/net/i2p/client/streaming/Connection.java
+++ b/apps/streaming/java/src/net/i2p/client/streaming/Connection.java
@@ -32,6 +32,7 @@ public class Connection {
private long _lastSendTime;
private long _lastSendId;
private boolean _resetReceived;
+ private boolean _resetSent;
private boolean _connected;
private boolean _hardDisconnected;
private MessageInputStream _inputStream;
@@ -178,6 +179,7 @@ public class Connection {
*
*/
void sendReset() {
+ _resetSent = true;
if ( (_remotePeer == null) || (_sendStreamId == null) ) return;
PacketLocal reply = new PacketLocal(_context, _remotePeer);
reply.setFlag(Packet.FLAG_RESET);
@@ -380,6 +382,7 @@ public class Connection {
public boolean getIsConnected() { return _connected; }
public boolean getHardDisconnected() { return _hardDisconnected; }
+ public boolean getResetSent() { return _resetSent; }
void disconnect(boolean cleanDisconnect) {
disconnect(cleanDisconnect, true);
diff --git a/apps/streaming/java/src/net/i2p/client/streaming/SchedulerHardDisconnected.java b/apps/streaming/java/src/net/i2p/client/streaming/SchedulerHardDisconnected.java
index d20489567..1ba4d3d26 100644
--- a/apps/streaming/java/src/net/i2p/client/streaming/SchedulerHardDisconnected.java
+++ b/apps/streaming/java/src/net/i2p/client/streaming/SchedulerHardDisconnected.java
@@ -34,7 +34,7 @@ class SchedulerHardDisconnected extends SchedulerImpl {
public boolean accept(Connection con) {
if (con == null) return false;
long timeSinceClose = _context.clock().now() - con.getCloseSentOn();
- boolean ok = (con.getHardDisconnected()) &&
+ boolean ok = (con.getHardDisconnected() || con.getResetSent()) &&
(timeSinceClose < Connection.DISCONNECT_TIMEOUT);
return ok;
}
diff --git a/history.txt b/history.txt
index 627fd7398..ecf39d46f 100644
--- a/history.txt
+++ b/history.txt
@@ -1,4 +1,11 @@
-$Id: history.txt,v 1.108 2004/12/15 21:45:56 jrandom Exp $
+$Id: history.txt,v 1.109 2004/12/16 00:42:04 jrandom Exp $
+
+2004-12-16 jrandom
+ * Catch another oddball case for a reset connection in the streaming lib.
+ * Add a dumpprofile.jsp page, called with ?peer=base64OfPeerHash, which
+ dumps the current state of that peer's profile. Instead of the full
+ base64, you can pass in however many characters you have and it will
+ return the first match found.
2004-12-16 jrandom
* Remove the randomized factor in the tunnel rejection by bandwidth -
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index 3fc2dce40..d917da52f 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
- public final static String ID = "$Revision: 1.113 $ $Date: 2004/12/15 21:45:55 $";
+ public final static String ID = "$Revision: 1.114 $ $Date: 2004/12/16 00:42:04 $";
public final static String VERSION = "0.4.2.3";
- public final static long BUILD = 7;
+ public final static long BUILD = 8;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);
diff --git a/router/java/src/net/i2p/router/peermanager/ProfilePersistenceHelper.java b/router/java/src/net/i2p/router/peermanager/ProfilePersistenceHelper.java
index b51c4cc98..5dc0831d4 100644
--- a/router/java/src/net/i2p/router/peermanager/ProfilePersistenceHelper.java
+++ b/router/java/src/net/i2p/router/peermanager/ProfilePersistenceHelper.java
@@ -70,9 +70,9 @@ class ProfilePersistenceHelper {
groups = "not failing";
} else {
if (_context.profileOrganizer().isFast(profile.getPeer()))
- groups = "fast and reliable";
+ groups = "fast and high capacity";
else
- groups = "reliable";
+ groups = "high capacity";
if (_context.profileOrganizer().isWellIntegrated(profile.getPeer()))
groups = groups + ", well integrated";
@@ -85,6 +85,7 @@ class ProfilePersistenceHelper {
buf.append("# as calculated by ").append(_us.toBase64()).append(NL);
buf.append("#").append(NL);
buf.append("# reliability: ").append(profile.getReliabilityValue()).append(NL);
+ buf.append("# capacity: ").append(profile.getCapacityValue()).append(NL);
buf.append("# integration: ").append(profile.getIntegrationValue()).append(NL);
buf.append("# speedValue: ").append(profile.getSpeedValue()).append(NL);
buf.append("#").append(NL);