fixed merge issues

This commit is contained in:
Greg Wilkins 2014-07-04 23:22:40 +10:00
parent 706fe1eba3
commit ca1a9ceb7c
3 changed files with 15 additions and 18 deletions

View File

@ -569,7 +569,6 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
private final ByteBufferPool.Lease lease = new ByteBufferPool.Lease(generator.getByteBufferPool());
private final int maxGather;
private final List<FlusherEntry> active;
private boolean closed;
private Flusher(int maxGather)
{
@ -582,7 +581,7 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
boolean fail = false;
synchronized (queue)
{
if (closed)
if (isClosed())
fail = true;
else
queue.offer(entry);
@ -598,7 +597,7 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
boolean fail = false;
synchronized (queue)
{
if (closed)
if (isClosed())
fail = true;
else
queue.add(0, entry);
@ -620,9 +619,6 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
{
synchronized (queue)
{
if (closed)
return Action.IDLE;
int sessionWindow = getWindowSize();
int nonStalledIndex = 0;
int size = queue.size();
@ -749,20 +745,16 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
Queue<FlusherEntry> queued;
synchronized (queue)
{
closed = true;
super.close();
queued = new ArrayDeque<>(queue);
}
}
if (LOG.isDebugEnabled())
LOG.debug("Closing, queued={}", queued.size());
while (true)
{
FlusherEntry item = queued.poll();
if (item == null)
break;
for (FlusherEntry item: queued)
closed(item);
}
}
protected void closed(FlusherEntry item)

View File

@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
@ -53,6 +54,7 @@ import org.eclipse.jetty.util.log.StdErrLog;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@ -127,6 +129,7 @@ public class RequestTest
}
@Ignore("Empty headers are not 7230 compliant")
@Test
public void testEmptyHeaders() throws Exception
{
@ -1058,6 +1061,7 @@ public class RequestTest
}
@Ignore("No longer relevant")
@Test
public void testCookieLeak() throws Exception
{
@ -1103,7 +1107,7 @@ public class RequestTest
+
"POST / HTTP/1.1\r\n"+
"Host: whatever\r\n"+
"Cookie:\r\n"+
"Cookie: \r\n"+
"Connection: close\r\n"+
"\r\n";

View File

@ -19,6 +19,7 @@
package org.eclipse.jetty.util;
import java.io.EOFException;
import java.nio.channels.ClosedChannelException;
import java.util.concurrent.atomic.AtomicReference;
/**
@ -360,7 +361,7 @@ public abstract class IteratingCallback implements Callback
}
}
public final void close()
public void close()
{
while (true)
{
@ -376,7 +377,7 @@ public abstract class IteratingCallback implements Callback
default:
if (_state.compareAndSet(current, State.CLOSED))
{
onCompleteFailure(new IllegalStateException("Closed with pending callback "+this));
onCompleteFailure(new ClosedChannelException());
return;
}
}