forked from I2P_Developers/i2p.i2p
2004-12-06 jrandom
* Don't propogate streaming connection failures out to the SAM bridge as fatal errors. * Dont barf on repeated I2CP closure.
This commit is contained in:
@ -205,7 +205,8 @@ public class SAMStreamSession {
|
|||||||
SAMStreamSessionSocketHandler handler = getSocketHandler(id);
|
SAMStreamSessionSocketHandler handler = getSocketHandler(id);
|
||||||
|
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
_log.error("Trying to send bytes through inexistent handler " +id);
|
if (_log.shouldLog(Log.WARN))
|
||||||
|
_log.error("Trying to send bytes through inexistent handler " +id);
|
||||||
// even though it failed, we need to read those bytes!
|
// even though it failed, we need to read those bytes!
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
int c = in.read();
|
int c = in.read();
|
||||||
@ -482,12 +483,30 @@ public class SAMStreamSession {
|
|||||||
byte buf[] = ba.getData();
|
byte buf[] = ba.getData();
|
||||||
while (remaining > 0) {
|
while (remaining > 0) {
|
||||||
int read = in.read(buf, 0, remaining > buf.length ? buf.length : remaining);
|
int read = in.read(buf, 0, remaining > buf.length ? buf.length : remaining);
|
||||||
if (read == -1)
|
if (read == -1) {
|
||||||
throw new IOException("Insufficient data from the SAM client (" + remaining + "/" + size + ")");
|
throw new IOException("Insufficient data from the SAM client (" + remaining + "/" + size + ")");
|
||||||
else if (read > 0)
|
} else if (read > 0) {
|
||||||
i2pSocketOS.write(buf, 0, read);
|
remaining -= read;
|
||||||
|
try {
|
||||||
|
i2pSocketOS.write(buf, 0, read);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
// ok, the stream failed, but the SAM client didn't
|
||||||
|
if (_log.shouldLog(Log.WARN))
|
||||||
|
_log.warn("Stream failed", ioe);
|
||||||
|
|
||||||
remaining -= read;
|
removeSocketHandler(id);
|
||||||
|
|
||||||
|
// emtpy the remaining payload so we can continue
|
||||||
|
for (int i = remaining; i > 0; i--) {
|
||||||
|
int c = in.read();
|
||||||
|
if (c == -1)
|
||||||
|
throw new IOException("Stream closed, but the SAM client didn't send enough anyway ("
|
||||||
|
+ i + " remaining)");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
cache.release(ba);
|
cache.release(ba);
|
||||||
|
@ -67,6 +67,7 @@ class I2CPMessageProducer {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void disconnect(I2PSessionImpl session) throws I2PSessionException {
|
public void disconnect(I2PSessionImpl session) throws I2PSessionException {
|
||||||
|
if (session.isClosed()) return;
|
||||||
DestroySessionMessage dmsg = new DestroySessionMessage();
|
DestroySessionMessage dmsg = new DestroySessionMessage();
|
||||||
dmsg.setSessionId(session.getSessionId());
|
dmsg.setSessionId(session.getSessionId());
|
||||||
session.sendMessage(dmsg);
|
session.sendMessage(dmsg);
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
$Id: history.txt,v 1.97 2004/12/05 19:54:08 jrandom Exp $
|
$Id: history.txt,v 1.98 2004/12/05 21:08:03 jrandom Exp $
|
||||||
|
|
||||||
|
2004-12-06 jrandom
|
||||||
|
* Don't propogate streaming connection failures out to the SAM bridge as
|
||||||
|
fatal errors.
|
||||||
|
* Dont barf on repeated I2CP closure.
|
||||||
|
|
||||||
2004-12-05 jrandom
|
2004-12-05 jrandom
|
||||||
* Explicitly use "127.0.0.1" to bind the I2CP listener, not the JVM's
|
* Explicitly use "127.0.0.1" to bind the I2CP listener, not the JVM's
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.102 $ $Date: 2004/12/05 19:54:07 $";
|
public final static String ID = "$Revision: 1.103 $ $Date: 2004/12/05 21:08:02 $";
|
||||||
public final static String VERSION = "0.4.2.2";
|
public final static String VERSION = "0.4.2.2";
|
||||||
public final static long BUILD = 6;
|
public final static long BUILD = 7;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION);
|
System.out.println("I2P Router version: " + VERSION);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
Reference in New Issue
Block a user