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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -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()) ) {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -6,7 +6,7 @@
|
||||
<title>SyndieMedia addressbook</title>
|
||||
<link href="style.jsp" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<body><!-- auth? <%=user.getAuthenticated()%> remote? <%=user.getAllowAccessRemote()%> sched? <%=request.getParameter("scheduleSyndication")%> -->
|
||||
<table border="1" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr class="b_toplogo"><td colspan="5" valign="top" align="left" class="b_toplogo"><jsp:include page="_toplogo.jsp" /></td></tr>
|
||||
<tr><td valign="top" align="left" rowspan="2" class="b_leftnav"><jsp:include page="_leftnav.jsp" /></td>
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
%><span class="b_addrMsgOk">Address updated</span><%
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
%><span class="b_addrMsgOk">Address added</span><%
|
||||
}
|
||||
} 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());
|
||||
%><span class="b_addrMsgOk">Address removed</span><%
|
||||
@ -65,6 +84,7 @@ if (!user.getAuthenticated()) {
|
||||
<td class="b_addrHeader"><em class="b_addrHeader">Protocol</em></td>
|
||||
<td class="b_addrHeader"><em class="b_addrHeader">Location</em></td>
|
||||
<td class="b_addrHeader"><em class="b_addrHeader">Public?</em></td>
|
||||
<td class="b_addrHeader"><em class="b_addrHeader">Automated?</em></td>
|
||||
<td class="b_addrHeader"><em class="b_addrHeader">Groups</em></td>
|
||||
<td class="b_addrHeader"> </td></tr>
|
||||
<%
|
||||
@ -146,6 +166,10 @@ if (!user.getAuthenticated()) {
|
||||
if (name.getIsPublic())
|
||||
buf.append("checked=\"true\" ");
|
||||
buf.append(" /></td>");
|
||||
buf.append("<td class=\"b_scheduled\"><input class=\"b_scheduled\" type=\"checkbox\" name=\"scheduleSyndication\" value=\"true\" ");
|
||||
if (BlogManager.instance().syndicationScheduled(name.getLocation()))
|
||||
buf.append("checked=\"true\" ");
|
||||
buf.append(" /></td>");
|
||||
buf.append("<td class=\"b_addrGroup\"><input class=\"b_addrGroup\" type=\"text\" name=\"groups\" size=\"10\" value=\"");
|
||||
for (int j = 0; j < name.getGroupCount(); j++) {
|
||||
buf.append(HTMLRenderer.sanitizeTagParam(name.getGroup(j)));
|
||||
@ -185,6 +209,7 @@ if (!user.getAuthenticated()) {
|
||||
<option value="syndieblog" <%="syndieblog".equalsIgnoreCase(proto) ? " selected=\"true\" " : ""%>>Syndie blog</option></select></td>
|
||||
<td class="b_addrLoc"><input class="b_addrLoc" type="text" size="50" name="location" value="<%=loc%>" /></td>
|
||||
<td class="b_addrPublic"><input class="b_addrPublic" type="checkbox" name="isPublic" /></td>
|
||||
<td class="b_scheduled"><input class="b_sheduled" type="checkbox" name="scheduleSyndication" value="true" /></td>
|
||||
<td class="b_addrGroup"><input class="b_addrGroup" type="text" name="groups" size="10" /></td>
|
||||
<td class="b_addrDetail"><input class="b_addrAdd" type="submit" name="action" value="Add" /></td>
|
||||
</form></tr>
|
||||
|
11
history.txt
11
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
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user