From 4dd628dbc8f9173e8dc40c3797047bf4a880db9f Mon Sep 17 00:00:00 2001 From: jrandom Date: Wed, 5 Oct 2005 23:24:33 +0000 Subject: [PATCH] 2005-10-05 jrandom * Allow the first few packets in the stream to fill in their IDs during handshake (thanks cervantes, Complication, et al!) This should fix at least some of the intermittent HTTP POST issues. --- .../java/src/net/i2p/client/streaming/Connection.java | 6 ++++-- .../java/src/net/i2p/client/streaming/Packet.java | 6 ++++-- .../src/net/i2p/client/streaming/PacketHandler.java | 5 +++-- history.txt | 7 ++++++- install-headless.txt | 7 +++---- router/java/src/net/i2p/router/RouterVersion.java | 4 ++-- .../net/i2p/router/transport/tcp/TCPTransport.java | 11 ++++++----- 7 files changed, 28 insertions(+), 18 deletions(-) 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 6161723d3..ae44e8db1 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/Connection.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/Connection.java @@ -936,8 +936,10 @@ public class Connection { _packet.setFlag(Packet.FLAG_DELAY_REQUESTED); _packet.setOptionalMaxSize(getOptions().getMaxMessageSize()); _packet.setResendDelay(getOptions().getResendDelay()); - //_packet.setReceiveStreamId(_receiveStreamId); - //_packet.setSendStreamId(_sendStreamId); + if (_packet.getReceiveStreamId() <= 0) + _packet.setReceiveStreamId(_receiveStreamId); + if (_packet.getSendStreamId() <= 0) + _packet.setSendStreamId(_sendStreamId); int newWindowSize = getOptions().getWindowSize(); diff --git a/apps/streaming/java/src/net/i2p/client/streaming/Packet.java b/apps/streaming/java/src/net/i2p/client/streaming/Packet.java index 16e0c56c2..da8100081 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/Packet.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/Packet.java @@ -152,7 +152,8 @@ public class Packet { /** what stream do we send data to the peer on? */ public long getSendStreamId() { return _sendStreamId; } public void setSendStreamId(long id) { - if (_sendStreamIdSet) throw new RuntimeException("Send stream ID already set [" + _sendStreamId + ", " + id + "]"); + if ( (_sendStreamIdSet) && (_sendStreamId > 0) ) + throw new RuntimeException("Send stream ID already set [" + _sendStreamId + ", " + id + "]"); _sendStreamIdSet = true; _sendStreamId = id; } @@ -164,7 +165,8 @@ public class Packet { */ public long getReceiveStreamId() { return _receiveStreamId; } public void setReceiveStreamId(long id) { - if (_receiveStreamIdSet) throw new RuntimeException("Receive stream ID already set [" + _receiveStreamId + ", " + id + "]"); + if ( (_receiveStreamIdSet) && (_receiveStreamId > 0) ) + throw new RuntimeException("Receive stream ID already set [" + _receiveStreamId + ", " + id + "]"); _receiveStreamIdSet = true; _receiveStreamId = id; } 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 6c27ebde9..d62230264 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java @@ -161,7 +161,8 @@ public class PacketHandler { } } else { if ( (con.getSendStreamId() <= 0) || - (DataHelper.eq(con.getSendStreamId(), packet.getReceiveStreamId())) ) { + (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()); @@ -229,7 +230,7 @@ public class PacketHandler { if (sendId <= 0) { Connection con = _manager.getConnectionByOutboundId(packet.getReceiveStreamId()); if (con != null) { - if (con.getAckedPackets() <= 0) { + if ( (con.getHighestAckedThrough() <= 5) && (packet.getSequenceNum() <= 5) ) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Received additional packets before the syn on " + con + ": " + packet); receiveKnownCon(con, packet); diff --git a/history.txt b/history.txt index b627afdbc..fa61e7b6d 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,9 @@ -$Id: history.txt,v 1.281 2005/10/04 02:36:25 jrandom Exp $ +$Id: history.txt,v 1.282 2005/10/04 18:43:05 jrandom Exp $ + +2005-10-05 jrandom + * Allow the first few packets in the stream to fill in their IDs during + handshake (thanks cervantes, Complication, et al!) This should fix at + least some of the intermittent HTTP POST issues. 2005-10-04 jrandom * Syndie patch for single user remote archives (thanks nickless_head!) diff --git a/install-headless.txt b/install-headless.txt index 4eccd217b..eb543ecc1 100644 --- a/install-headless.txt +++ b/install-headless.txt @@ -1,11 +1,10 @@ -$Id: install-headless.txt,v 1.4 2004/12/21 11:32:50 jrandom Exp $ +$Id: install-headless.txt,v 1.5 2005/09/29 14:19:23 jrandom Exp $ Headless I2P installation instructions 1) tar xjf i2p.tar.bz2 (you've already done this) 2) cd i2p ; vi install-headless.txt (you're doing this now) -3) java -jar lib/reseed.jar (optional) -4) sh postinstall.sh (this launches the router) -5) lynx http://localhost:7657/index.jsp (configure the router) +3) sh postinstall.sh (this launches the router) +4) lynx http://localhost:7657/index.jsp (configure the router) If you're having trouble, swing by http://forum.i2p.net/, check the website at http://www.i2p.net/, or get on irc://irc.freenode.net/#i2p diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index f9b6aca01..cf01bdcfe 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.256 $ $Date: 2005/10/04 02:36:25 $"; + public final static String ID = "$Revision: 1.257 $ $Date: 2005/10/04 18:43:05 $"; public final static String VERSION = "0.6.1.1"; - public final static long BUILD = 3; + public final static long BUILD = 4; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID); diff --git a/router/java/src/net/i2p/router/transport/tcp/TCPTransport.java b/router/java/src/net/i2p/router/transport/tcp/TCPTransport.java index 554360625..42f2d173b 100644 --- a/router/java/src/net/i2p/router/transport/tcp/TCPTransport.java +++ b/router/java/src/net/i2p/router/transport/tcp/TCPTransport.java @@ -488,8 +488,8 @@ public class TCPTransport extends TransportImpl { if (Boolean.valueOf(allowLocal).booleanValue()) { return true; } else { - if (_log.shouldLog(Log.ERROR)) - _log.error("External address " + address + " is not publicly routable"); + if (_log.shouldLog(Log.WARN)) + _log.warn("External address " + address + " is not publicly routable"); return false; } } else { @@ -726,11 +726,12 @@ public class TCPTransport extends TransportImpl { continue; } if (!allowAddress(tcpAddr)) { - _log.error("Message points at illegal address! " - + msg.getTarget().getIdentity().calculateHash().toBase64().substring(0,6)); + _log.error("Message points at illegal address! router " + + msg.getTarget().getIdentity().calculateHash().toBase64().substring(0,6) + + " address " + tcpAddr.toString()); iter.remove(); - _context.shitlist().shitlistRouter(peer, "Invalid addressaddress..."); + _context.shitlist().shitlistRouter(peer, "Invalid TCP address..."); _context.netDb().fail(peer); for (int i = 0; i < msgs.size(); i++) { OutNetMessage cur = (OutNetMessage)msgs.get(i);