374611: do not redispatch if already dispatched when SSL reads content on write

This commit is contained in:
Greg Wilkins 2012-03-19 15:48:39 +11:00
parent cf2c283653
commit 7e3b8bcfd4
5 changed files with 25 additions and 7 deletions

View File

@ -276,6 +276,11 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector
_endp.shutdownOutput();
}
public void dispatch()
{
_endp.asyncDispatch();
}
public void asyncDispatch()
{
_endp.asyncDispatch();

View File

@ -19,7 +19,14 @@ public interface AsyncEndPoint extends ConnectedEndPoint
{
/* ------------------------------------------------------------ */
/**
* Dispatch the endpoint to a thread to attend to it.
* Dispatch the endpoint if it is not already dispatched
*
*/
public void dispatch();
/* ------------------------------------------------------------ */
/**
* Dispatch the endpoint. If it is already dispatched, schedule a redispatch
*
*/
public void asyncDispatch();

View File

@ -208,11 +208,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
{
synchronized(this)
{
if (_dispatched)
{
throw new IllegalStateException("dispatched");
}
else
if (!_dispatched)
{
_dispatched = true;
boolean dispatched = _manager.dispatch(_handler);

View File

@ -412,7 +412,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
// If we are reading into the temp buffer and it has some content, then we should be dispatched.
if (toFill==_unwrapBuf && _unwrapBuf.hasContent() && !_connection.isSuspended())
_aEndp.asyncDispatch();
_aEndp.dispatch();
}
finally
{
@ -721,6 +721,11 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
process(null, null);
}
public void dispatch()
{
_aEndp.dispatch();
}
public void asyncDispatch()
{
_aEndp.asyncDispatch();

View File

@ -32,6 +32,11 @@ public class EmptyAsyncEndPoint implements AsyncEndPoint
private boolean closed;
private int maxIdleTime;
@Override
public void dispatch()
{
}
@Override
public void asyncDispatch()
{