SAMv1 and SAMv3 : logging some exception at INFO level

This commit is contained in:
mkvore-commit
2009-05-24 16:04:57 +00:00
parent 29489ad198
commit e86e42818a
6 changed files with 25 additions and 7 deletions

View File

@ -107,11 +107,26 @@ public class SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatag
break;
}
msg = DataHelper.readLine(getClientSocket().socket().getInputStream()).trim();
SocketChannel clientSocketChannel = getClientSocket() ;
if (clientSocketChannel == null) {
_log.info("Connection closed by client");
break;
}
if (clientSocketChannel.socket() == null) {
_log.info("Connection closed by client");
break;
}
java.io.InputStream is = clientSocketChannel.socket().getInputStream();
if (is == null) {
_log.info("Connection closed by client");
break;
}
msg = DataHelper.readLine(is);
if (msg == null) {
_log.debug("Connection closed by client");
_log.info("Connection closed by client (line read : null)");
break;
}
msg = msg.trim();
if (_log.shouldLog(Log.DEBUG)) {
_log.debug("New message received: [" + msg + "]");

View File

@ -38,7 +38,7 @@ public class SAMv3DatagramSession extends SAMDatagramSession implements SAMv3Han
* @throws I2PSessionException
*/
public SAMv3DatagramSession(String nick)
throws IOException, DataFormatException, I2PSessionException {
throws IOException, DataFormatException, I2PSessionException, SAMException {
super(SAMv3Handler.sSessionsHash.get(nick).getDest(),
SAMv3Handler.sSessionsHash.get(nick).getProps(),
@ -49,7 +49,7 @@ public class SAMv3DatagramSession extends SAMDatagramSession implements SAMv3Han
this.server = SAMv3Handler.DatagramServer.getInstance() ;
SAMv3Handler.SessionRecord rec = SAMv3Handler.sSessionsHash.get(nick);
if ( rec==null ) throw new InterruptedIOException() ;
if ( rec==null ) throw new SAMException("Record disappeared for nickname : \""+nick+"\"") ;
this.handler = rec.getHandler();

View File

@ -564,7 +564,7 @@ public class SAMv3Handler extends SAMv1Handler
_log.debug("I2P error when instantiating session", e);
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + " MESSAGE=\"" + e.getMessage() + "\"\n");
} catch (SAMException e) {
_log.error("Unexpected SAM error", e);
_log.info("Funny SAM error", e);
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + " MESSAGE=\"" + e.getMessage() + "\"\n");
} catch (IOException e) {
_log.error("Unexpected IOException", e);

View File

@ -197,7 +197,7 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle
SAMv3Handler.SessionRecord rec = SAMv3Handler.sSessionsHash.get(nick);
if ( rec==null ) throw new InterruptedIOException() ;
if ( rec==null || i2ps==null ) throw new InterruptedIOException() ;
if (verbose)
handler.notifyStreamIncomingConnection(i2ps.getPeerDestination()) ;

View File

@ -1,3 +1,6 @@
2009-05-24 mkvore
* SAM: logging some exceptions at INFO level instead of ERROR
2009-05-23 Mathiasdm
* Router netDB:
- Added flags to the netDB page

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 3;
public final static long BUILD = 4;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;