SAM: Don't log an error on datagram send success!

set i2cp.fastReceive=true
log tweaks
This commit is contained in:
zzz
2016-02-17 14:11:18 +00:00
parent 27d0a81bcb
commit 455f32faa7
2 changed files with 18 additions and 17 deletions

View File

@ -453,8 +453,8 @@ class SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatagramRece
String dest = props.getProperty("DESTINATION"); String dest = props.getProperty("DESTINATION");
if (dest == null) { if (dest == null) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldWarn())
_log.debug("Destination not specified in SEND message"); _log.warn("Destination not specified in SEND message");
return false; return false;
} }
@ -522,27 +522,27 @@ class SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatagramRece
in.readFully(data); in.readFully(data);
SAMMessageSess sess = isRaw ? rawSession : datagramSession; SAMMessageSess sess = isRaw ? rawSession : datagramSession;
if (sess.sendBytes(dest, data, proto, fromPort, toPort)) { if (!sess.sendBytes(dest, data, proto, fromPort, toPort)) {
_log.error("SEND failed"); if (_log.shouldWarn())
_log.warn((isRaw ? "SEND RAW to " : "SEND DATAGRAM to ") + dest + " size " + size +
" failed");
// a message send failure is no reason to drop the SAM session // a message send failure is no reason to drop the SAM session
// for raw and repliable datagrams, just carry on our merry way // for raw and repliable datagrams, just carry on our merry way
return true;
} }
return true; return true;
} catch (EOFException e) { } catch (EOFException e) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldWarn())
_log.debug("Too few bytes with SEND message (expected: " _log.warn("Too few bytes with SEND message (expected: "
+ size); + size, e);
return false; return false;
} catch (IOException e) { } catch (IOException e) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldWarn())
_log.debug("Caught IOException while parsing SEND message", _log.warn("Caught IOException while parsing SEND message",
e); e);
return false; return false;
} catch (DataFormatException e) { } catch (DataFormatException e) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldWarn())
_log.debug("Invalid key specified with SEND message", _log.warn("Invalid key specified with SEND message",
e); e);
return false; return false;
} catch (I2PSessionException e) { } catch (I2PSessionException e) {
@ -550,8 +550,8 @@ class SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatagramRece
return false; return false;
} }
} else { } else {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldWarn())
_log.debug("Unrecognized message opcode: \"" _log.warn("Unrecognized message opcode: \""
+ opcode + "\""); + opcode + "\"");
return false; return false;
} }
@ -571,8 +571,8 @@ class SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatagramRece
} else if (opcode.equals("CLOSE")) { } else if (opcode.equals("CLOSE")) {
return execStreamClose(props); return execStreamClose(props);
} else { } else {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldWarn())
_log.debug("Unrecognized STREAM message opcode: \"" _log.warn("Unrecognized STREAM message opcode: \""
+ opcode + "\""); + opcode + "\"");
return false; return false;
} }

View File

@ -458,6 +458,7 @@ class SAMv3Handler extends SAMv1Handler
// (iMule sets BestEffort) as None is more efficient // (iMule sets BestEffort) as None is more efficient
// and the client has no way to access delivery notifications // and the client has no way to access delivery notifications
i2cpProps.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_NONE); i2cpProps.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_NONE);
i2cpProps.setProperty("i2cp.fastReceive", "true");
// Record the session in the database sSessionsHash // Record the session in the database sSessionsHash
Properties allProps = new Properties(); Properties allProps = new Properties();