2004-12-03 jrandom

* Toss in a small pool of threads (3) to execute the events queued up with
      the SimpleTimer, as we do currently see the occational event
      notification spiking up to a second or so.
    * Implement a SAM client API in java, useful for event based streaming (or
      for testing the SAM bridge)
    * Added support to shut down the SAM bridge on OOM (useful if the SAM
      bridge is being run outside of the router).
    * Include the SAM test code in the sam.jar
    * Remove an irrelevent warning message from SAM, which was caused by
      perfectly normal operation due to a session being closed.
    * Removed some unnecessary synchronization in the streaming lib's
      PacketQueue
    * More quickly clean up the memory used by the streaming lib by
      immediately killing each packet's resend job as soon as it is ACKed (or
      cancelled), so that there are no longer any valid pointers to the
      (potentially 32KB) packet.
    * Fixed the timestamps dumped to stdout when debugging the PacketHandler.
    * Drop packets that would expand our inbound window beyond our maximum
      buffer size (default 32 messages)
    * Always read the ACK/NACK data from the verified packets received, even
      if we are going to drop them
    * Always adjust the window when there are messages ACKed, though do not
      change its size except as before.
    * Streamlined some synchronization in the router's I2CP handling
    * Streamlined some memory allocation in the SAM bridge
    * Default the streaming lib to disconnect on inactivity, rather than send
      an empty message.
this still doesnt get the BT to where it needs to be, or fix the timeout problem,
but i dont like having so many commits outstanding and these updates are sound
This commit is contained in:
jrandom
2004-12-04 23:40:50 +00:00
committed by zzz
parent f54687f398
commit 1a30cd5f4a
29 changed files with 1287 additions and 186 deletions

View File

@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.97 $ $Date: 2004/12/01 19:27:27 $";
public final static String ID = "$Revision: 1.98 $ $Date: 2004/12/01 22:20:03 $";
public final static String VERSION = "0.4.2.2";
public final static long BUILD = 1;
public final static long BUILD = 2;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@@ -25,8 +25,6 @@ class ClientWriterRunner implements Runnable {
private static final long MAX_WAIT = 5*1000;
/** notify this lock when there are messages to write */
private Object _activityLock = new Object();
/** lock on this when updating the class level data structs */
private Object _dataLock = new Object();
@@ -47,9 +45,7 @@ class ClientWriterRunner implements Runnable {
synchronized (_dataLock) {
_messagesToWrite.add(msg);
_messagesToWriteTimes.add(new Long(_context.clock().now()));
}
synchronized (_activityLock) {
_activityLock.notifyAll();
_dataLock.notifyAll();
}
if (_log.shouldLog(Log.DEBUG))
_log.debug("["+_id+"] addMessage completed for " + msg.getClass().getName());
@@ -60,8 +56,8 @@ class ClientWriterRunner implements Runnable {
*
*/
public void stopWriting() {
synchronized (_activityLock) {
_activityLock.notifyAll();
synchronized (_dataLock) {
_dataLock.notifyAll();
}
}
public void run() {
@@ -70,6 +66,9 @@ class ClientWriterRunner implements Runnable {
List messageTimes = null;
synchronized (_dataLock) {
if (_messagesToWrite.size() <= 0)
try { _dataLock.wait(); } catch (InterruptedException ie) {}
if (_messagesToWrite.size() > 0) {
messages = new ArrayList(_messagesToWrite.size());
messageTimes = new ArrayList(_messagesToWriteTimes.size());
@@ -80,16 +79,7 @@ class ClientWriterRunner implements Runnable {
}
}
if (messages == null) {
try {
synchronized (_activityLock) {
_activityLock.wait();
}
} catch (InterruptedException ie) {
if (_log.shouldLog(Log.WARN))
_log.warn("Interrupted while waiting for activity", ie);
}
} else {
if (messages != null) {
for (int i = 0; i < messages.size(); i++) {
I2CPMessage msg = (I2CPMessage)messages.get(i);
Long when = (Long)messageTimes.get(i);

View File

@@ -769,8 +769,8 @@ public class TCPTransport extends TransportImpl {
/** Make this stuff pretty (only used in the old console) */
public String renderStatusHTML() {
StringBuffer buf = new StringBuffer(1024);
buf.append("<b>Connections:</b><ul>\n");
synchronized (_connectionLock) {
buf.append("<b>Connections (").append(_connectionsByIdent.size()).append("):</b><ul>\n");
for (Iterator iter = _connectionsByIdent.values().iterator(); iter.hasNext(); ) {
TCPConnection con = (TCPConnection)iter.next();
buf.append("<li>");