From 7f6e65c76f75846cfd7489836957619f30a6662d Mon Sep 17 00:00:00 2001 From: jrandom Date: Fri, 7 Oct 2005 10:22:59 +0000 Subject: [PATCH] 2005-10-07 jrandom * Allow the I2PTunnelHTTPServer to send back the first few packets of an HTTP response quicker, and initialize the streaming lib's cwin more carefully. * Added a small web UI to the new Syndie scheduled updater. If you log in as a user authorized to use the remote archive funtionality, you can request remote archives in your address book to be automatically pulled down by checking the "scheduled?" checkbox. --- .../i2p/i2ptunnel/I2PTunnelHTTPServer.java | 2 +- .../net/i2p/client/streaming/Connection.java | 10 ++++-- .../i2p/client/streaming/PacketHandler.java | 17 ++++++++-- .../java/src/net/i2p/syndie/BlogManager.java | 33 +++++++++++++++++++ .../java/src/net/i2p/syndie/Updater.java | 7 +++- apps/syndie/jsp/addresses.jsp | 27 ++++++++++++++- history.txt | 11 ++++++- .../src/net/i2p/router/RouterVersion.java | 4 +-- 8 files changed, 99 insertions(+), 12 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java index 895d5a57c..2af483734 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java @@ -219,7 +219,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer { protected void beginProcessing() throws IOException { if (_log.shouldLog(Log.INFO)) _log.info("Beginning compression processing"); - out.flush(); + //out.flush(); _gzipOut = new InternalGZIPOutputStream(out); out = _gzipOut; } 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 ae44e8db1..58cf008d6 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/Connection.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/Connection.java @@ -102,7 +102,7 @@ public class Connection { _closeSentOn = -1; _closeReceivedOn = -1; _unackedPacketsReceived = 0; - _congestionWindowEnd = 0; + _congestionWindowEnd = _options.getWindowSize()-1; _highestAckedThrough = -1; _lastCongestionSeenAt = MAX_WINDOW_SIZE*2; // lets allow it to grow _lastCongestionTime = -1; @@ -153,8 +153,12 @@ public class Connection { synchronized (_outboundPackets) { if (!started) _context.statManager().addRateData("stream.chokeSizeBegin", _outboundPackets.size(), timeoutMs); - if (!_connected) - return false; + + // no need to wait until the other side has ACKed us before sending the first few wsize + // packets through + // if (!_connected) + // return false; + started = true; if ( (_outboundPackets.size() >= _options.getWindowSize()) || (_activeResends > 0) || (_lastSendId - _highestAckedThrough > _options.getWindowSize()) ) { diff --git a/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java b/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java index d62230264..b96aaf005 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java @@ -163,9 +163,20 @@ public class PacketHandler { if ( (con.getSendStreamId() <= 0) || (DataHelper.eq(con.getSendStreamId(), packet.getReceiveStreamId())) || (packet.getSequenceNum() <= 5) ) { // its in flight from the first batch - long oldId =con.getSendStreamId(); - if (packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) // con fully established, w00t - con.setSendStreamId(packet.getReceiveStreamId()); + long oldId = con.getSendStreamId(); + if (packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) { + if (oldId <= 0) { + // con fully established, w00t + con.setSendStreamId(packet.getReceiveStreamId()); + } else if (oldId == packet.getReceiveStreamId()) { + // ok, as expected... + } else { + if (_log.shouldLog(Log.ERROR)) + _log.error("Received a syn with the wrong IDs, con=" + con + " packet=" + packet); + packet.releasePayload(); + return; + } + } try { con.getPacketHandler().receivePacket(packet, con); diff --git a/apps/syndie/java/src/net/i2p/syndie/BlogManager.java b/apps/syndie/java/src/net/i2p/syndie/BlogManager.java index bf2d53bf4..5399e6cd8 100644 --- a/apps/syndie/java/src/net/i2p/syndie/BlogManager.java +++ b/apps/syndie/java/src/net/i2p/syndie/BlogManager.java @@ -647,4 +647,37 @@ public class BlogManager { } } } + + public void scheduleSyndication(String location) { + String archives[] = getUpdateArchives(); + StringBuffer buf = new StringBuffer(64); + if ( (archives != null) && (archives.length > 0) ) { + for (int i = 0; i < archives.length; i++) + if ( (!archives[i].equals(location)) && (archives[i].trim().length() > 0) ) + buf.append(archives[i]).append(","); + } + if ( (location != null) && (location.trim().length() > 0) ) + buf.append(location.trim()); + System.setProperty("syndie.updateArchives", buf.toString()); + Updater.wakeup(); + } + public void unscheduleSyndication(String location) { + String archives[] = getUpdateArchives(); + if ( (archives != null) && (archives.length > 0) ) { + StringBuffer buf = new StringBuffer(64); + for (int i = 0; i < archives.length; i++) + if ( (!archives[i].equals(location)) && (archives[i].trim().length() > 0) ) + buf.append(archives[i]).append(","); + System.setProperty("syndie.updateArchives", buf.toString()); + } + } + public boolean syndicationScheduled(String location) { + String archives[] = getUpdateArchives(); + if ( (location == null) || (archives == null) || (archives.length <= 0) ) + return false; + for (int i = 0; i < archives.length; i++) + if (location.equals(archives[i])) + return true; + return false; + } } diff --git a/apps/syndie/java/src/net/i2p/syndie/Updater.java b/apps/syndie/java/src/net/i2p/syndie/Updater.java index 349026747..2e4b698b8 100644 --- a/apps/syndie/java/src/net/i2p/syndie/Updater.java +++ b/apps/syndie/java/src/net/i2p/syndie/Updater.java @@ -10,10 +10,15 @@ public class Updater { public static final String VERSION = "1.0"; private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Updater.class); private static final Updater _instance = new Updater(); + private long _lastUpdate; public void update() { - _log.debug("Update started."); BlogManager bm = BlogManager.instance(); + if (_lastUpdate + bm.getUpdateDelay()*60*60*1000 > System.currentTimeMillis()) { + return; + } + _lastUpdate = System.currentTimeMillis(); + _log.debug("Update started."); User user = new User(); RemoteArchiveBean rab = new RemoteArchiveBean(); String[] archives = bm.getUpdateArchives(); diff --git a/apps/syndie/jsp/addresses.jsp b/apps/syndie/jsp/addresses.jsp index 52a82cd68..d0c8ba754 100644 --- a/apps/syndie/jsp/addresses.jsp +++ b/apps/syndie/jsp/addresses.jsp @@ -6,7 +6,7 @@ SyndieMedia addressbook - + @@ -31,6 +31,15 @@ if (!user.getAuthenticated()) { names.remove(oldPetname); names.set(cur.getName(), cur); names.store(user.getAddressbookLocation()); + if ( ("syndiearchive".equals(cur.getProtocol())) && (BlogManager.instance().authorizeRemote(user)) ) { + if (null != request.getParameter("scheduleSyndication")) { + BlogManager.instance().scheduleSyndication(cur.getLocation()); + BlogManager.instance().writeConfig(); + } else { + BlogManager.instance().unscheduleSyndication(cur.getLocation()); + BlogManager.instance().writeConfig(); + } + } %>Address updated<% } } else if ( (action != null) && ("Add".equals(action)) ) { @@ -45,11 +54,21 @@ if (!user.getAuthenticated()) { cur.setGroups(request.getParameter("groups")); names.set(cur.getName(), cur); names.store(user.getAddressbookLocation()); + if ( ("syndiearchive".equals(cur.getProtocol())) && (BlogManager.instance().authorizeRemote(user)) ) { + if (null != request.getParameter("scheduleSyndication")) { + BlogManager.instance().scheduleSyndication(cur.getLocation()); + BlogManager.instance().writeConfig(); + } + } %>Address added<% } } else if ( (action != null) && ("Delete".equals(action)) ) { PetName cur = names.get(request.getParameter("name")); if (cur != null) { + if ( ("syndiearchive".equals(cur.getProtocol())) && (BlogManager.instance().authorizeRemote(user)) ) { + BlogManager.instance().unscheduleSyndication(cur.getLocation()); + BlogManager.instance().writeConfig(); + } names.remove(cur.getName()); names.store(user.getAddressbookLocation()); %>Address removed<% @@ -65,6 +84,7 @@ if (!user.getAuthenticated()) { + <% @@ -146,6 +166,10 @@ if (!user.getAuthenticated()) { if (name.getIsPublic()) buf.append("checked=\"true\" "); buf.append(" />"); + buf.append(""); buf.append(" + diff --git a/history.txt b/history.txt index fa61e7b6d..2ea7f51bd 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,13 @@ -$Id: history.txt,v 1.282 2005/10/04 18:43:05 jrandom Exp $ +$Id: history.txt,v 1.283 2005/10/05 18:24:33 jrandom Exp $ + +2005-10-07 jrandom + * Allow the I2PTunnelHTTPServer to send back the first few packets of an + HTTP response quicker, and initialize the streaming lib's cwin more + carefully. + * Added a small web UI to the new Syndie scheduled updater. If you log in + as a user authorized to use the remote archive funtionality, you can + request remote archives in your address book to be automatically pulled + down by checking the "scheduled?" checkbox. 2005-10-05 jrandom * Allow the first few packets in the stream to fill in their IDs during diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index cf01bdcfe..9e4e506ce 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.257 $ $Date: 2005/10/04 18:43:05 $"; + public final static String ID = "$Revision: 1.258 $ $Date: 2005/10/05 18:24:33 $"; public final static String VERSION = "0.6.1.1"; - public final static long BUILD = 4; + public final static long BUILD = 5; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID);
Protocol Location Public?Automated? Groups  
>Syndie blog