Removed guard whether the channel is closed in checkIdleTimestamp().

This follows commit ff29a1cc51 for JETTY-1322.
The reason to remove the guard is that the channel may be closed multiple times, and if for any reason
a check to the idle timestamp triggers, then the idle callback is invoked, but it's not really idle: it is
already closed.
When used with SSL, this causes a truncation attack exception thrown by SSLEngine, because the idle
callback causes a shutdown of the SSLEngine without having received a SSL close alert.
This commit is contained in:
Simone Bordet 2011-12-13 11:14:25 +01:00
parent 416b6a8a15
commit fa0e06d186
1 changed files with 4 additions and 4 deletions

View File

@ -262,25 +262,25 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
{
_idleTimestamp=check?System.currentTimeMillis():0;
}
/* ------------------------------------------------------------ */
public boolean isCheckForIdle()
{
return _idleTimestamp!=0;
}
/* ------------------------------------------------------------ */
protected void notIdle()
{
if (_idleTimestamp!=0)
_idleTimestamp=System.currentTimeMillis();
}
/* ------------------------------------------------------------ */
public void checkIdleTimestamp(long now)
{
long idleTimestamp=_idleTimestamp;
if (!getChannel().isOpen() || idleTimestamp!=0 && _maxIdleTime>0 && now>(idleTimestamp+_maxIdleTime))
if (idleTimestamp!=0 && _maxIdleTime>0 && now>(idleTimestamp+_maxIdleTime))
{
onIdleExpired();
_idleTimestamp=now;