Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project

This commit is contained in:
Greg Wilkins 2014-09-18 07:03:40 +10:00
commit c8198d0531
4 changed files with 28 additions and 25 deletions

View File

@ -88,6 +88,11 @@ public class StreamResetTest extends AbstractTest
stream.reset(resetFrame, Callback.Adapter.INSTANCE);
Assert.assertTrue(resetLatch.await(5, TimeUnit.SECONDS));
// Wait a while to let the server remove the
// stream after returning from onReset().
Thread.sleep(1000);
Stream serverStream = streamRef.get();
Assert.assertEquals(0, serverStream.getSession().getStreams().size());
}

View File

@ -84,18 +84,31 @@ public class HttpTransportOverHTTP2 implements HttpTransport
{
if (commit.compareAndSet(false, true))
{
boolean endStream = !hasContent && lastContent;
commit(info, endStream, sendContent ? commitCallback : callback);
if (sendContent)
{
commit(info, false, commitCallback);
send(content, lastContent, callback);
}
else
{
commit(info, lastContent, callback);
}
}
else
{
callback.failed(new IllegalStateException());
}
}
if (sendContent)
else
{
send(content, lastContent, callback);
if (sendContent)
{
send(content, lastContent, callback);
}
else
{
callback.succeeded();
}
}
}

View File

@ -80,7 +80,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
@Override
protected boolean needsFill()
{
return !changeInterests(SelectionKey.OP_READ, true);
changeInterests(SelectionKey.OP_READ, true);
return false;
}
@Override
@ -166,14 +167,13 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
}
}
private boolean changeInterests(int operation, boolean add)
private void changeInterests(int operation, boolean add)
{
/**
* This method may run concurrently with {@link #updateKey()}.
*/
boolean pending = false;
boolean changed = true;
while (true)
{
State current = _interestState.get();
@ -204,20 +204,6 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
else
newInterestOps = oldInterestOps & ~operation;
if (isInputShutdown())
{
newInterestOps &= ~SelectionKey.OP_READ;
if (add && (operation & SelectionKey.OP_READ) != 0)
changed = false;
}
if (isOutputShutdown())
{
newInterestOps &= ~SelectionKey.OP_WRITE;
if (add && (operation & SelectionKey.OP_WRITE) != 0)
changed = false;
}
if (LOG.isDebugEnabled())
LOG.debug("changeInterests pending={} {}->{} for {}", pending, oldInterestOps, newInterestOps, this);
@ -232,8 +218,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
// This must be done after CASing the state above, otherwise the
// selector may select and call onSelected() concurrently.
submitKeyUpdate(!pending);
return changed;
return;
}
default:
{

View File

@ -266,7 +266,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
finally
{
setCurrentConnection(last);
if (!suspended && !getEndPoint().isInputShutdown() && getEndPoint().getConnection()==this)
if (!suspended && getEndPoint().isOpen() && getEndPoint().getConnection() == this)
{
fillInterested();
}