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); stream.reset(resetFrame, Callback.Adapter.INSTANCE);
Assert.assertTrue(resetLatch.await(5, TimeUnit.SECONDS)); 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(); Stream serverStream = streamRef.get();
Assert.assertEquals(0, serverStream.getSession().getStreams().size()); Assert.assertEquals(0, serverStream.getSession().getStreams().size());
} }

View File

@ -84,18 +84,31 @@ public class HttpTransportOverHTTP2 implements HttpTransport
{ {
if (commit.compareAndSet(false, true)) if (commit.compareAndSet(false, true))
{ {
boolean endStream = !hasContent && lastContent; if (sendContent)
commit(info, endStream, sendContent ? commitCallback : callback); {
commit(info, false, commitCallback);
send(content, lastContent, callback);
}
else
{
commit(info, lastContent, callback);
}
} }
else else
{ {
callback.failed(new IllegalStateException()); callback.failed(new IllegalStateException());
} }
} }
else
if (sendContent)
{ {
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 @Override
protected boolean needsFill() protected boolean needsFill()
{ {
return !changeInterests(SelectionKey.OP_READ, true); changeInterests(SelectionKey.OP_READ, true);
return false;
} }
@Override @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()}. * This method may run concurrently with {@link #updateKey()}.
*/ */
boolean pending = false; boolean pending = false;
boolean changed = true;
while (true) while (true)
{ {
State current = _interestState.get(); State current = _interestState.get();
@ -204,20 +204,6 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
else else
newInterestOps = oldInterestOps & ~operation; 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()) if (LOG.isDebugEnabled())
LOG.debug("changeInterests pending={} {}->{} for {}", pending, oldInterestOps, newInterestOps, this); 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 // This must be done after CASing the state above, otherwise the
// selector may select and call onSelected() concurrently. // selector may select and call onSelected() concurrently.
submitKeyUpdate(!pending); submitKeyUpdate(!pending);
return;
return changed;
} }
default: default:
{ {

View File

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